[ADD] docuseal_signing: request Docuseal signatures from Odoo #1

Open
mondot wants to merge 15 commits from docuseal_signing into 18.0
Owner

cf https://elabore.coop/web#id=6127&cids=1&menu_id=198&action=317&active_id=83&model=project.task&view_type=form

Electronic signature integration between Odoo 18 and a Docuseal
instance: configure signature templates in Odoo, pre-fill them with
contact data and request signatures from partners in a few clicks.

  • docuseal.template: reference a Docuseal template by its ID; the
    "Fetch from Docuseal" button loads its submitter roles (picked from
    a dropdown) and the fields of the selected role.
  • docuseal.template.field: map each Docuseal field to a res.partner
    field. Pre-filled values are locked for the signer; empty ones stay
    editable. Dates, relational and selection fields are sent as
    human-readable labels.
  • Generate a contextual server action on res.partner that creates one
    submission per selected contact and emails the signature request.
    _create_draft_submissions() creates the pre-filled submission
    without sending it.
  • The "Request signature" action is reserved to administrators and
    runs on a single contact; Docuseal API errors are reported to the
    user.
  • Docuseal API URL and token configurable in General Settings.
  • French translation, README and unit tests (API payload, fields
    fetch, server action).
cf https://elabore.coop/web#id=6127&cids=1&menu_id=198&action=317&active_id=83&model=project.task&view_type=form Electronic signature integration between Odoo 18 and a Docuseal instance: configure signature templates in Odoo, pre-fill them with contact data and request signatures from partners in a few clicks. - docuseal.template: reference a Docuseal template by its ID; the "Fetch from Docuseal" button loads its submitter roles (picked from a dropdown) and the fields of the selected role. - docuseal.template.field: map each Docuseal field to a res.partner field. Pre-filled values are locked for the signer; empty ones stay editable. Dates, relational and selection fields are sent as human-readable labels. - Generate a contextual server action on res.partner that creates one submission per selected contact and emails the signature request. _create_draft_submissions() creates the pre-filled submission without sending it. - The "Request signature" action is reserved to administrators and runs on a single contact; Docuseal API errors are reported to the user. - Docuseal API URL and token configurable in General Settings. - French translation, README and unit tests (API payload, fields fetch, server action).
mondot added 12 commits 2026-11-09 14:44:14 +00:00
_create_submissions gets a send_email parameter (default True, so the
"Request signature" contextual action is unchanged), passed to the Docuseal
API. It now returns the Docuseal response of each created submission
(submitter id, slug, submission_id...) so callers can build a link to it.

New _create_draft_submissions helper: creates pre-filled submissions with
send_email=False, to be reviewed then sent for signature from Docuseal.

Also adds help texts on template_id and submitter_role.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Pre-filled values were converted with str(), so a Many2one such as the
partner title was sent as "res.partner.title(5,)" and a selection field
as its technical key. Send the display name of relational fields and the
label of selection fields instead.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the module README documenting purpose, features (template
registry, field mapping, contextual server action, settings) and
installation requirements.

Remove ``res.partner#request_docuseal_signature``, which was introduced
as a public entry point for other code but was never called: the
generated server action calls ``docuseal.template._create_submissions``
directly. The template method is now the single entry point for
signature requests.

Assisted-By: GLM-5.3-Flash
``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
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
- Deleting a ``docuseal.template`` now removes its generated contextual
  server action; an orphaned action would browse a deleted template at
  runtime and crash.
- The display notification strings are wrapped in ``_()`` so they are
  translatable, with their French translations in the catalog.
- Add a short manifest description so the Apps page renders plain text
  instead of parsing the markdown README as reStructuredText.

Covered by a unit test on the template deletion lifecycle.

Assisted-By: GLM-5.3-Flash
[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
f9a8358e95
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
mondot added 1 commit 2026-11-09 15:47:52 +00:00
[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
c7f3a2dcfe
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>
mondot added 1 commit 2026-11-09 16:06:29 +00:00
[FIX] docuseal_signing: restrict signature requests and report API errors
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m31s
tests / test (pull_request) Successful in 50s
87653552b1
- Reserve the generated "Request signature" action to administrators
  (base.group_system), who are the only ones able to read the Docuseal
  templates, instead of letting other users hit an AccessError.
- Request the signature of a single contact from the contextual action
  (_action_request_signature): with several contacts, a failure could
  leave some of them already emailed while the action reports an error.
  A notification confirms the request.
- Share the Docuseal API call in _docuseal_request: a missing token or a
  Docuseal error (with the explanation it sends) now raises a readable
  UserError when sending submissions too, not only when fetching.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
mondot added 1 commit 2026-11-09 16:39:37 +00:00
[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
fddc2e5c4b
- 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>
mondot reviewed 2026-11-12 09:02:20 +00:00
@@ -0,0 +42,4 @@
(API calls use the standard library).
- A reachable Docuseal instance with an API token is needed at runtime.
## Technical usage
Author
Owner

À renommer en "Additional developers features" + respecter structure README oca.

Puis ok pour merger

À renommer en "Additional developers features" + respecter structure README oca. Puis ok pour merger
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m31s
tests / test (pull_request) Successful in 52s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin docuseal_signing:docuseal_signing
git checkout docuseal_signing
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Elabore/docuseal-tools#1
No description provided.