[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>
This commit is contained in:
2026-11-09 17:35:19 +01:00
parent 87653552b1
commit fddc2e5c4b
7 changed files with 238 additions and 27 deletions

View File

@@ -15,7 +15,9 @@ signatures from partners in a few clicks.
- **Field mapping** (`docuseal.template.field`): map each Docuseal
field of the selected role to a `res.partner` field. Fetching again
keeps the existing mappings; changing the role loads the fields of
the new role from Docuseal with an empty mapping. Fields are kept in
the new role from Docuseal with an empty mapping (with a warning in
the form). Once fetched, the template ID is read-only: another
Docuseal template needs a new entry. Fields are kept in
the order returned by the Docuseal API (reorderable with drag &
drop). Values are
pre-filled at submission time and locked so the signer cannot change
@@ -65,7 +67,8 @@ Behavior of both calls:
- One Docuseal submission is created per partner, using the template's
Docuseal `template_id` and `submitter_role_id`; the partner's `name`
and `email` identify the submitter.
and `email` identify the submitter. When the request is emailed, every
partner must have an email address: otherwise nothing is sent.
- Each mapped Docuseal field is pre-filled from the partner field set
in `docuseal.template.field`. Non-empty values are locked
(`readonly=True`) so the signer cannot change them; empty values
@@ -75,7 +78,8 @@ Behavior of both calls:
their human-readable label.
- Both methods return the list of Docuseal API responses (one dict per
submission). A missing API token or a Docuseal error (with the
explanation sent by Docuseal) raises a `UserError`; with several
explanation sent by Docuseal), an invalid API URL or an unreachable
instance raises a `UserError`; with several
partners, the submissions created before the error are not rolled
back in Docuseal.