CRM Lead Token SomConnexio
This module adds the customizations of Som Connexió over the crm_lead_token module.
The token of a crm.lead is no longer a random string generated by Odoo: it is asked to SomOffice, the same way the invoice tokens are generated in invoice_somconnexio. The customer VAT is implicit in the token, because SomOffice signs the pair (user, lead):
GET api/token/user/<vat>/lead/<lead_id>/
Documentation request email
Besides the token itself, this module asks the customer to upload their documentation. Once a crm.lead reaches the New stage (crm.stage_lead1) - whether it is created directly in New or created in another stage and later written into it - a delayed job - send.lead.docs.request - binds a SomOffice token to the lead, builds the tokenized URL the customer uploads the documentation to (crm_documentation_tokenized_url), and mails it over using the company’s lead_docs_request_mail_template_id. A lead created outside New and never written into it is never asked for its documentation.
Nothing is asked for a lead without a VAT to bind the token to (see Usage): it keeps the random token of crm_lead_token, which SomOffice would not resolve.
Nothing is sent twice: once crm_documentation_tokenized_url is set, a lead going through this again (e.g. created a second time by mistake) is left untouched, so the token’s expiration keeps counting from the first request.
Passing the skip_documentation_stage context key on create disables the request entirely - the same context key crm_lead_dms_somconnexio uses to opt out of its own documentation review flow, so a caller opting out of one opts out of both, and does not need to know about SomOffice or mock it out in its own tests.
Configuration
The SomOffice connection is the one already used by oficinavirtual_somconnexio: SOMOFFICE_URL, SOMOFFICE_USER and SOMOFFICE_PASSWORD environment variables.
The delay (in minutes) before the documentation request email is sent after a lead reaches the New stage can be set in Settings > CRM > Documentation, or via the crm_lead_token_somconnexio.send_documentation_request_minute_delay system parameter. It defaults to 20 minutes.
Usage
Once a crm.lead reaches the New stage, its token is asked to SomOffice using:
the partner VAT (partner_id.vat), or
the subscription request VAT (subscription_request_id.vat) when the lead has no partner yet.
Every lead created by our processes has a partner or a subscription request, and the VAT is kept when a validated subscription request creates its partner, so the token does not need to be regenerated afterwards. Leads created without partner nor subscription request keep the random token generated by crm_lead_token, and are not sent the documentation request email.
Credits
Contributors
-
Borja Gimeno <borja.gimeno@somconnexio.coop>
Release files for odoo-addon-crm-lead-token-somconnexio 16.0.1.0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| odoo_addon_crm_lead_token_somconnexio-16.0.1.0.0.6.tar.gz | 11.2 kB | Details |
Release files / odoo_addon_crm_lead_token_somconnexio-16.0.1.0.0.6.tar.gz
| Download URL | odoo_addon_crm_lead_token_somconnexio-16.0.1.0.0.6.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1599ea0a5c5d36a1b3355270f571db5a20dc6e977e8c15def3880da8bb218d6
|
|
BLAKE2b-256 checksum How to use checksums |
2622abd218c83ce27a1deeb67aaa338d7afd543bd3dd6a2fa4c31a2999073e1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|