Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions crm_sign_oca/README.rst
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.
1 change: 1 addition & 0 deletions crm_sign_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions crm_sign_oca/__manifest__.py
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)",
Copy link
Copy Markdown
Member

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)",

"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"],
}
8 changes: 8 additions & 0 deletions crm_sign_oca/demo/sign_oca_role.xml
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>
18 changes: 18 additions & 0 deletions crm_sign_oca/demo/sign_oca_template.xml
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>
4 changes: 4 additions & 0 deletions crm_sign_oca/models/__init__.py
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
49 changes: 49 additions & 0 deletions crm_sign_oca/models/crm_lead.py
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
14 changes: 14 additions & 0 deletions crm_sign_oca/models/res_company.py
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",
)
15 changes: 15 additions & 0 deletions crm_sign_oca/models/res_config_settings.py
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,
)
24 changes: 24 additions & 0 deletions crm_sign_oca/models/sign_oca_request.py
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
3 changes: 3 additions & 0 deletions crm_sign_oca/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions crm_sign_oca/readme/CONFIGURE.md
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
2 changes: 2 additions & 0 deletions crm_sign_oca/readme/CONTRIBUTORS.md
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>\>
1 change: 1 addition & 0 deletions crm_sign_oca/readme/DESCRIPTION.md
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.
5 changes: 5 additions & 0 deletions crm_sign_oca/readme/USAGE.md
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.
Binary file added crm_sign_oca/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading