[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>
This commit is contained in:
2026-11-09 16:47:05 +01:00
parent f9a8358e95
commit c7f3a2dcfe
9 changed files with 419 additions and 70 deletions

View File

@@ -8,11 +8,16 @@ signatures from partners in a few clicks.
## Features
- **Template registry** (`docuseal.template`): reference Docuseal
templates by their ID and submitter role, and fetch their field list
from the Docuseal API with a single click.
templates by their ID; the *Fetch from Docuseal* button loads their
submitter roles and fields from the Docuseal API. The submitter role
is picked from a dropdown listing only the roles of the template
(`docuseal.template.role`); the first one is selected by default.
- **Field mapping** (`docuseal.template.field`): map each Docuseal
field to a `res.partner` field. Fields are kept in the order returned
by the Docuseal API (reorderable with drag & drop). Values are
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 order returned by the Docuseal API (reorderable with drag &
drop). Values are
pre-filled at submission time and locked so the signer cannot change
them (empty mappings stay editable by the signer).
- **One-click signature request**: generate a server action bound to
@@ -56,7 +61,7 @@ template._create_draft_submissions(partners)
Behavior of both calls:
- One Docuseal submission is created per partner, using the template's
Docuseal `template_id` and `submitter_role`; the partner's `name`
Docuseal `template_id` and `submitter_role_id`; the partner's `name`
and `email` identify the submitter.
- Each mapped Docuseal field is pre-filled from the partner field set
in `docuseal.template.field`. Non-empty values are locked