-
-
Notifications
You must be signed in to change notification settings - Fork 70
[18.0] [ADD] crm_sign_oca: add module #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
luisDIXMIT
wants to merge
1
commit into
OCA:18.0
Choose a base branch
from
dixmit:18.0-add-crm_sign_oca
base: 18.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| ============ | ||
| Crm Sign Oca | ||
| ============ | ||
|
|
||
| .. | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! source digest: sha256:bb1c4c6fbebab88e825902a837740a7f427e1a789d7ab4bb41530fd27f6f35ed | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
| :target: https://odoo-community.org/page/development-status | ||
| :alt: Beta | ||
| .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
| :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
| :alt: License: AGPL-3 | ||
| .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsign-lightgray.png?logo=github | ||
| :target: https://github.com/OCA/sign/tree/18.0/crm_sign_oca | ||
| :alt: OCA/sign | ||
| .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
| :target: https://translation.odoo-community.org/projects/sign-18-0/sign-18-0-crm_sign_oca | ||
| :alt: Translate me on Weblate | ||
| .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
| :target: https://runboat.odoo-community.org/builds?repo=OCA/sign&target_branch=18.0 | ||
| :alt: Try me on Runboat | ||
|
|
||
| |badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
|
||
| This module links the Sign app with the CRM. In this way, a document can | ||
| be sent for signature to the related partners in the CRM model, and the | ||
| signed documents will be linked to the corresponding CRM record. | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Configuration | ||
| ============= | ||
|
|
||
| To configure this module, you need to: | ||
|
|
||
| - Go to Sign and create a sign template | ||
| - Go to Sign > Settings > Roles, create a role, set the "Partner | ||
| Selection Policy" to "Expression" and define an expression | ||
|
|
||
| Usage | ||
| ===== | ||
|
|
||
| - Once you have configured the sign template for the CRM model as | ||
| explained in CONFIGURE.md, you can go to a CRM record, open it, and | ||
| click the gear button. | ||
|
|
||
| - Select the option "Sign from template", choose the configured | ||
| template, and write a message for the signer. | ||
|
|
||
| - The signer must log into the system and sign the request. | ||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/OCA/sign/issues>`_. | ||
| In case of trouble, please check there if your issue has already been reported. | ||
| If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
| `feedback <https://github.com/OCA/sign/issues/new?body=module:%20crm_sign_oca%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
|
||
| Do not contact contributors directly about support or help with technical issues. | ||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Authors | ||
| ------- | ||
|
|
||
| * Dixmit | ||
|
|
||
| Contributors | ||
| ------------ | ||
|
|
||
| - `Dixmit <https://dixmit.com>`__: | ||
|
|
||
| - Luis David Rodríguez <luis.rodriguez@dixmit.com> | ||
|
|
||
| Maintainers | ||
| ----------- | ||
|
|
||
| This module is maintained by the OCA. | ||
|
|
||
| .. image:: https://odoo-community.org/logo.png | ||
| :alt: Odoo Community Association | ||
| :target: https://odoo-community.org | ||
|
|
||
| OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
| mission is to support the collaborative development of Odoo features and | ||
| promote its widespread use. | ||
|
|
||
| This module is part of the `OCA/sign <https://github.com/OCA/sign/tree/18.0/crm_sign_oca>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Copyright 2025 Dixmit | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| { | ||
| "name": "Crm Sign Oca", | ||
| "summary": """CRM Sign OCA""", | ||
| "version": "18.0.1.0.0", | ||
| "license": "AGPL-3", | ||
| "author": "Dixmit,Odoo Community Association (OCA)", | ||
| "website": "https://github.com/OCA/sign", | ||
| "depends": [ | ||
| "sign_oca", | ||
| "crm", | ||
| ], | ||
| "data": [ | ||
| "views/crm_lead_views.xml", | ||
| "views/res_config_settings_view.xml", | ||
| "views/sign_oca_request.xml", | ||
| ], | ||
| "demo": ["demo/sign_oca_role.xml", "demo/sign_oca_template.xml"], | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <odoo> | ||
| <record id="role_crm_signer" model="sign.oca.role"> | ||
| <field name="name">CRM Signatory Person</field> | ||
| <field name="partner_selection_policy">expression</field> | ||
| <field name="expression_partner">{{object.user_id.partner_id.id}}</field> | ||
| </record> | ||
| </odoo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <odoo> | ||
| <record id="sign_oca_template_crm_lead_demo" model="sign.oca.template"> | ||
| <field name="name">Crm</field> | ||
| <field name="model_id" ref="crm.model_crm_lead" /> | ||
| <field name="data" type="base64" file="sign_oca/tests/empty.pdf" /> | ||
| </record> | ||
| <record id="sign_oca_template_crm_lead_demo_item_0" model="sign.oca.template.item"> | ||
| <field name="template_id" ref="crm_sign_oca.sign_oca_template_crm_lead_demo" /> | ||
| <field name="field_id" ref="sign_oca.sign_field_name" /> | ||
| <field name="role_id" ref="crm_sign_oca.role_crm_signer" /> | ||
| <field name="page">1</field> | ||
| <field name="position_x">10</field> | ||
| <field name="position_y">10</field> | ||
| <field name="width">10</field> | ||
| <field name="height">10</field> | ||
| <field name="required" eval="True" /> | ||
| </record> | ||
| </odoo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| from . import crm_lead | ||
| from . import res_company | ||
| from . import res_config_settings | ||
| from . import sign_oca_request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Copyright 2025 Dixmit | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import api, fields, models | ||
|
|
||
|
|
||
| class CrmLead(models.Model): | ||
| _inherit = "crm.lead" | ||
|
|
||
| sign_request_ids = fields.One2many( | ||
| comodel_name="sign.oca.request", | ||
| inverse_name="crm_lead_id", | ||
| string="Sign Requests", | ||
| ) | ||
| sign_request_count = fields.Integer( | ||
| string="Sign request count", | ||
| compute="_compute_sign_request_count", | ||
| compute_sudo=True, | ||
| store=True, | ||
| ) | ||
|
|
||
| @api.depends("sign_request_ids") | ||
| def _compute_sign_request_count(self): | ||
| request_data = self.env["sign.oca.request"].read_group( | ||
| [("crm_lead_id", "in", self.ids)], | ||
| ["crm_lead_id"], | ||
| ["crm_lead_id"], | ||
| ) | ||
| mapped_data = { | ||
| x["crm_lead_id"][0]: x["crm_lead_id_count"] for x in request_data | ||
| } | ||
| for item in self: | ||
| item.sign_request_count = mapped_data.get(item.id, 0) | ||
|
|
||
| def action_view_sign_requests(self): | ||
| self.ensure_one() | ||
| result = self.env["ir.actions.act_window"]._for_xml_id( | ||
| "sign_oca.sign_oca_request_act_window" | ||
| ) | ||
| result["domain"] = [("id", "in", self.sign_request_ids.ids)] | ||
| ctx = dict(self.env.context) | ||
| ctx.update( | ||
| { | ||
| "default_crm_lead_id": self.id, | ||
| "search_default_crm_lead_id": self.id, | ||
| } | ||
| ) | ||
| result["context"] = ctx | ||
| return result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Copyright 2025 Dixmit | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class ResCompany(models.Model): | ||
| _inherit = "res.company" | ||
|
|
||
| crm_lead_sign_oca_template_id = fields.Many2one( | ||
| comodel_name="sign.oca.template", | ||
| domain="[('model_id.model', '=', 'crm.lead')]", | ||
| string="Sign Oca Template", | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Copyright 2025 Dixmit | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class ResConfigSettings(models.TransientModel): | ||
| _inherit = "res.config.settings" | ||
|
|
||
| crm_lead_sign_oca_template_id = fields.Many2one( | ||
| comodel_name="sign.oca.template", | ||
| related="company_id.crm_lead_sign_oca_template_id", | ||
| string="Sign Oca Template", | ||
| readonly=False, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Copyright 2025 Dixmit | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import api, fields, models | ||
|
|
||
|
|
||
| class SignOcaRequest(models.Model): | ||
| _inherit = "sign.oca.request" | ||
|
|
||
| # This field is required for the inverse of crm.lead. | ||
| crm_lead_id = fields.Many2one( | ||
| comodel_name="crm.lead", | ||
| compute="_compute_crm_lead_id", | ||
| string="CRM Lead", | ||
| readonly=True, | ||
| store=True, | ||
| ) | ||
|
|
||
| @api.depends("record_ref") | ||
| def _compute_crm_lead_id(self): | ||
| for item in self.filtered( | ||
| lambda x: x.record_ref and x.record_ref._name == "crm.lead" | ||
| ): | ||
| item.crm_lead_id = item.record_ref.id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [build-system] | ||
| requires = ["whool"] | ||
| build-backend = "whool.buildapi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| To configure this module, you need to: | ||
|
|
||
| - Go to Sign and create a sign template | ||
| - Go to Sign > Settings > Roles, create a role, set the "Partner Selection Policy" to "Expression" and define an expression |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - [Dixmit](https://dixmit.com): | ||
| - Luis David Rodríguez \<<luis.rodriguez@dixmit.com>\> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| This module links the Sign app with the CRM. In this way, a document can be sent for signature to the related partners in the CRM model, and the signed documents will be linked to the corresponding CRM record. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - Once you have configured the sign template for the CRM model as explained in CONFIGURE.md, you can go to a CRM record, open it, and click the gear button. | ||
|
|
||
| - Select the option "Sign from template", choose the configured template, and write a message for the signer. | ||
|
|
||
| - The signer must log into the system and sign the request. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"author": "Dixmit, Odoo Community Association (OCA)",