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
93 lines
3.3 KiB
Markdown
93 lines
3.3 KiB
Markdown
# Docuseal Signing
|
|
|
|
Electronic signature integration between Odoo and a
|
|
[Docuseal](https://www.docuseal.com/) instance: configure signature
|
|
templates in Odoo, pre-fill them with contact data and request
|
|
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.
|
|
- **Field mapping** (`docuseal.template.field`): map each Docuseal
|
|
field to a `res.partner` field. 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
|
|
`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
|
|
pre-filled submission without sending the email, so it can be sent
|
|
from Docuseal.
|
|
- **Settings**: configure the Docuseal API URL and API token in
|
|
*Settings → General Settings* (system parameters
|
|
`docuseal.api_url` and `docuseal.api_token`).
|
|
|
|
## Installation
|
|
|
|
- Requires Odoo 18.0.
|
|
- Depends only on `base` and `base_setup`; no extra Python package
|
|
(API calls use the standard library).
|
|
- A reachable Docuseal instance with an API token is needed at runtime.
|
|
|
|
## Technical usage
|
|
|
|
The module adds two methods for developers and server actions.
|
|
|
|
### Request a signature from code
|
|
|
|
```python
|
|
template = self.env["docuseal.template"].search(
|
|
[("template_id", "=", 12345)], limit=1
|
|
)
|
|
partners = self.env["res.partner"].browse([42, 43])
|
|
|
|
# Create a submission per partner and let Docuseal email the
|
|
# signature request:
|
|
results = template._create_submissions(partners)
|
|
|
|
# Or create pre-filled drafts without sending the email: the
|
|
# submission must then be sent from Docuseal.
|
|
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`
|
|
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
|
|
(`readonly=True`) so the signer cannot change them; empty values
|
|
stay editable.
|
|
- Date values are formatted as `%d/%m/%Y`, many2one/many2many values
|
|
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.
|
|
|
|
### From a server action
|
|
|
|
The generated contextual action calls the same entry point on the
|
|
selected records:
|
|
|
|
```python
|
|
env['docuseal.template'].browse(<template_record_id>)._create_submissions(records)
|
|
```
|
|
|
|
### Configuration
|
|
|
|
Both methods read the API credentials from system parameters
|
|
(`ir.config_parameter`):
|
|
|
|
- `docuseal.api_token` — the Docuseal API token (required), set in
|
|
*Settings → General Settings*.
|
|
- `docuseal.api_url` — the Docuseal instance base URL, defaulting to
|
|
`https://sign.elabore.coop`.
|
|
|
|
## Credits
|
|
|
|
- **Contributors**: Quentin Mondot <quentin@elabore.coop>
|
|
- **Maintainer**: [Elabore](https://elabore.coop)
|