[FIX] docuseal_signing: restrict signature requests and report API errors
- 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>
This commit is contained in:
@@ -22,8 +22,11 @@ signatures from partners in a few clicks.
|
||||
them (empty mappings stay editable by the signer).
|
||||
- **One-click signature request**: generate a server action bound to
|
||||
`res.partner` (contextual *Action* menu entry) that creates a Docuseal
|
||||
submission for the selected contacts and emails them the signature
|
||||
request. A draft mode (`_create_draft_submissions`) creates the
|
||||
submission for the selected contact and emails them the signature
|
||||
request. It is reserved to administrators (`base.group_system`, who
|
||||
manage the Docuseal templates), and only runs on a
|
||||
single contact so that a failure never leaves some contacts already
|
||||
emailed. A draft mode (`_create_draft_submissions`) creates the
|
||||
pre-filled submission without sending the email, so it can be sent
|
||||
from Docuseal.
|
||||
- **Settings**: configure the Docuseal API URL and API token in
|
||||
@@ -71,15 +74,19 @@ Behavior of both calls:
|
||||
as a comma-joined list of display names, and selection values as
|
||||
their human-readable label.
|
||||
- Both methods return the list of Docuseal API responses (one dict per
|
||||
submission); errors bubble up as exceptions if the API call fails.
|
||||
submission). A missing API token or a Docuseal error (with the
|
||||
explanation sent by Docuseal) raises a `UserError`; with several
|
||||
partners, the submissions created before the error are not rolled
|
||||
back in Docuseal.
|
||||
|
||||
### From a server action
|
||||
|
||||
The generated contextual action calls the same entry point on the
|
||||
selected records:
|
||||
The generated contextual action calls `_action_request_signature`,
|
||||
which refuses a selection of several contacts, then `_create_submissions`
|
||||
and shows a confirmation notification:
|
||||
|
||||
```python
|
||||
env['docuseal.template'].browse(<template_record_id>)._create_submissions(records)
|
||||
action = env['docuseal.template'].browse(<template_record_id>)._action_request_signature(records)
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
Reference in New Issue
Block a user