Commit Graph

5 Commits

Author SHA1 Message Date
fddc2e5c4b [FIX] docuseal_signing: harden template copies, API errors and emails
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m31s
tests / test (pull_request) Successful in 52s
- Do not copy the contextual action nor the submitter role with a
  template: a copy sharing the action would rewrite or delete the
  original's.
- Make the template ID read-only once fetched from Docuseal: another
  Docuseal template needs a new entry.
- Report an invalid API URL or token, an unexpected (non-JSON) response
  and a connection dropped mid-response as a readable UserError.
- Refuse to email a signature request to contacts without a valid email
  address (email_normalize), before any call to Docuseal.
- Stop logging the field values and the Docuseal response, which hold
  personal data and the signing links.
- Prevent adding mapping lines by hand: they come from Docuseal only.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 17:35:19 +01:00
c7f3a2dcfe [IMP] docuseal_signing: pick the submitter role from the Docuseal roles
Some checks failed
tests / test (pull_request) Successful in 56s
pre-commit / pre-commit (pull_request) Failing after 1m34s
The submitter role was a free text field. It is now a dropdown listing
only the submitter roles of the Docuseal template
(docuseal.template.role), fetched with the Docuseal UUID of each role.

- The "Fetch from Docuseal" button, now above the role, syncs the roles
  (matched by UUID then name, in the Docuseal order, the first one
  selected by default) and the fields of the selected role only,
  keeping the existing mappings.
- Changing the role fetches the fields of the new role from Docuseal
  with an empty mapping, and warns that saving loses the current one.
- Signature requests only send the fields of the submitter role.
- Docuseal API errors and a missing token raise a clear UserError.
- Keep the Docuseal field name of new mapping lines on save
  (force_save on the read-only column).

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 16:47:05 +01:00
f9a8358e95 [IMP] docuseal_signing: add unit tests for API payload and server action
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m28s
tests / test (pull_request) Successful in 51s
Cover with a mocked Docuseal API (shared ``DocusealApiMockMixin``
capturing every request):

- field value conversion matrix in ``_create_submissions``: char,
  selection label, many2one/many2many display names, date formatting,
  empty value left editable while set values are locked
- payload structure and one-submission-per-partner behavior
- draft submissions created with ``send_email`` disabled
- API URL trailing slash stripped
- server action creation is idempotent

Assisted-By: GLM-5.3-Flash
2026-11-09 15:39:26 +01:00
77d556c14a [IMP] docuseal_signing: keep the Docuseal field order in the mapping
Fields are now ordered as returned by the Docuseal API: a sequence
field (reorderable with drag & drop) is written by
``action_fetch_fields`` according to the API field order, so deleting
a mapping line and re-fetching restores the original order instead of
appending it at the end.

Also refresh the French catalog (new Sequence field, new help texts,
stale smart_search entries dropped).

Covered by a unit test reproducing the delete-then-refetch scenario.

Assisted-By: GLM-5.3-Flash
2026-11-09 15:39:26 +01:00
b3d0f4b0d3 [FIX] docuseal_signing: keep partner field mappings on fields fetch
``action_fetch_fields`` wiped the whole ``field_ids`` mapping on every
fetch, dropping the res.partner fields configured by the administrator.
Reconcile instead: keep existing mappings untouched, add fields new to
the Docuseal template and drop the ones removed from it.

Covered by unit tests running against a mocked Docuseal API.

Assisted-By: GLM-5.3-Flash
2026-11-09 15:39:26 +01:00