Repository: OCA/sign (language: python)

Issue:
[14.0][ADD] project_task_sign_oca: add new module
This module allows you to generate manual and automatic signature requests from project tasks to task customers.

Create and view sign requests directly from project tasks
![image](https://github.com/OCA/sign/assets/69807420/ad181557-0c91-429f-bfd1-f276629e92fe)

Define a template to enable automatic sign requests process
![image](https://github.com/OCA/sign/assets/69807420/ea2dcd0d-a458-4750-adc4-e4b35e16d49b)

The sign request will be linked to the project and task, and the customer (`partner_id`) of the task as a signer with the role defined in template.
![image](https://github.com/OCA/sign/assets/69807420/8b5b260c-a252-4a3a-b8b5-70301b072eb5)

cc: @marcelsavegnago @kaynnan @Matthwhy @douglascstd 



Discussion / hints:

Fix patch:
diff --git a/project_task_sign_oca/README.rst b/project_task_sign_oca/README.rst
new file mode 100644
index 00000000..41cd08d5
--- /dev/null
+++ b/project_task_sign_oca/README.rst
@@ -0,0 +1,118 @@
+=====================
+Project Task Sign Oca
+=====================
+
+.. 
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+   !! This file is generated by oca-gen-addon-readme !!
+   !! changes will be overwritten.                   !!
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+   !! source digest: sha256:29657adda23cf1e28d4658aefc324414ea987077225edc3677ea4b77519d4bf5
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+.. |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/14.0/project_task_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-14-0/sign-14-0-project_task_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=14.0
+    :alt: Try me on Runboat
+
+|badge1| |badge2| |badge3| |badge4| |badge5|
+
+This module allows you to generate manual and automatic signature requests from project tasks to task customers.
+
+**Table of contents**
+
+.. contents::
+   :local:
+
+Configuration
+=============
+
+#. Go to Sign > Roles and create a role with the following data:
+
+- Partner type: Expression
+- Expression: ${object.partner_id.id}
+
+#. Go to Sign > Templates and create a template with the following data:
+
+- Model: Project Task
+- In one of the fields, you must set the previously created role.
+
+#. (Optional) Go to Project > Configuration > Settings.
+
+- In the Task Sign section, define a template to enable automatic task sing requests.
+- Use the template previously created.
+
+Usage
+=====
+
+Creating a Signature Request from a Project Task:
+- Go to Projects > Tasks.
+- Open an existing task or create a new one (make sure to fill in the `partner_id` field).
+- In the task tree or form view, click on the action "Sign from template".
+- Sign Requests will have been generated (and sent) linked to the selected project and task.
+
+Automatic Signature Request creation:
+- Define a template in Project > Configuration > Settings.
+- When an customer is assigned to a task, a Sign Request will be created (and sent) automatically.
+
+Viewing Signature Requests:
+- Go to Projects > Tasks.
+- Open a task with an associated signature request.
+- Click on the smart-button Sign Requests.
+- Click on any signature request to view its details, status, and progress.
+- Alternatively, go to Sign > Requests.
+- Use the Group By feature to group requests by Project and/or Task.
+
+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:%20project_task_sign_oca%0Aversion:%2014.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
+~~~~~~~
+
+* Escodoo
+
+Contributors
+~~~~~~~~~~~~
+
+* `Escodoo <https://www.escodoo.com.br>`_:
+
+  * Marcel Savegnago <marcel.savegnago@escodoo.com.br>
+  * Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+
+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/14.0/project_task_sign_oca>`_ project on GitHub.
+
+You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/project_task_sign_oca/__init__.py b/project_task_sign_oca/__init__.py
new file mode 100644
index 00000000..0650744f
--- /dev/null
+++ b/project_task_sign_oca/__init__.py
@@ -0,0 +1,1 @@
+from . import models
diff --git a/project_task_sign_oca/__manifest__.py b/project_task_sign_oca/__manifest__.py
new file mode 100644
index 00000000..cab8dc72
--- /dev/null
+++ b/project_task_sign_oca/__manifest__.py
@@ -0,0 +1,22 @@
+# Copyright 2024 - TODAY, Escodoo
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+{
+    "name": "Project Task Sign Oca",
+    "summary": """
+        Project Task Sign Oca""",
+    "version": "14.0.1.0.0",
+    "license": "AGPL-3",
+    "author": "Escodoo, Odoo Community Association (OCA)",
+    "website": "https://github.com/OCA/sign",
+    "depends": ["sign_oca", "project"],
+    "data": [
+        "views/project_task.xml",
+        "views/res_config_settings.xml",
+        "views/sign_oca_request.xml",
+    ],
+    "demo": [
+        "demo/sign_oca_role.xml",
+        "demo/sign_oca_template.xml",
+    ],
+}
diff --git a/project_task_sign_oca/demo/sign_oca_role.xml b/project_task_sign_oca/demo/sign_oca_role.xml
new file mode 100644
index 00000000..72077361
--- /dev/null
+++ b/project_task_sign_oca/demo/sign_oca_role.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- Copyright 2024 - TODAY, Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+     License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
+<odoo>
+
+    <record id="sign_role_project_task_customer" model="sign.oca.role">
+        <field name="name">Task Customer</field>
+        <field name="partner_type">expression</field>
+        <field name="expression_partner">${object.partner_id.id}</field>
+    </record>
+
+</odoo>
diff --git a/project_task_sign_oca/demo/sign_oca_template.xml b/project_task_sign_oca/demo/sign_oca_template.xml
new file mode 100644
index 00000000..30d72193
--- /dev/null
+++ b/project_task_sign_oca/demo/sign_oca_template.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- Copyright 2024 - TODAY, Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+     License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
+<odoo>
+
+    <record id="sign_oca_template_project_task_demo" model="sign.oca.template">
+        <field name="name">Task Approval</field>
+        <field name="model_id" ref="project.model_project_task" />
+        <field name="data" type="base64" file="sign_oca/tests/empty.pdf" />
+    </record>
+    <record
+        id="sign_oca_template_project_task_demo_item"
+        model="sign.oca.template.item"
+    >
+        <field
+            name="template_id"
+            ref="project_task_sign_oca.sign_oca_template_project_task_demo"
+        />
+        <field name="field_id" ref="sign_oca.sign_field_signature" />
+        <field
+            name="role_id"
+            ref="project_task_sign_oca.sign_role_project_task_customer"
+        />
+        <field name="page">1</field>
+        <field name="position_x">10</field>
+        <field name="position_y">10</field>
+        <field name="width">30</field>
+        <field name="height">4</field>
+        <field name="required" eval="True" />
+    </record>
+
+</odoo>
diff --git a/project_task_sign_oca/models/__init__.py b/project_task_sign_oca/models/__init__.py
new file mode 100644
index 00000000..52bf9877
--- /dev/null
+++ b/project_task_sign_oca/models/__init__.py
@@ -0,0 +1,4 @@
+from . import project_task
+from . import res_company
+from . import res_config_settings
+from . import sign_oca_request
diff --git a/project_task_sign_oca/models/project_task.py b/project_task_sign_oca/models/project_task.py
new file mode 100644
index 00000000..f4ceedf5
--- /dev/null
+++ b/project_task_sign_oca/models/project_task.py
@@ -0,0 +1,60 @@
+# Copyright 2024 - TODAY, Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from odoo import api, fields, models
+
+
+class ProjectTask(models.Model):
+
+    _inherit = "project.task"
+
+    sign_request_ids = fields.One2many(
+        comodel_name="sign.oca.request",
+        inverse_name="task_id",
+        string="Sign Requests",
+    )
+    sign_request_count = fields.Integer(
+        string="Sign request count",
+        compute="_compute_sign_request_count",
+        compute_sudo=True,
+    )
+
+    @api.depends("sign_request_ids")
+    def _compute_sign_request_count(self):
+        for task in self:
+            task.sign_request_count = len(task.sign_request_ids)
+
+    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)]
+        return result
+
+    def _generate_sign_oca_request(self):
+        sign_request_obj = self.env["sign.oca.request"].sudo()
+        for task in self:
+            sign_template = task.company_id.project_task_sign_oca_template_id
+            if sign_template:
+                sign_template = sign_template.sudo()
+                request = sign_request_obj.create(
+                    sign_template._prepare_sign_oca_request_vals_from_record(task)
+                )
+                request.action_send()
+
+    @api.model_create_multi
+    def create(self, vals_list):
+        res = super().create(vals_list)
+        for task in res:
+            if task.partner_id:
+                task._generate_sign_oca_request()
+        return res
+
+    def write(self, vals):
+        old_partner_id = self.partner_id
+        new_partner_id = vals.get("partner_id")
+        res = super().write(vals)
+        if new_partner_id and new_partner_id != old_partner_id:
+            self._generate_sign_oca_request()
+        return res
diff --git a/project_task_sign_oca/models/res_company.py b/project_task_sign_oca/models/res_company.py
new file mode 100644
index 00000000..5c382c4c
--- /dev/null
+++ b/project_task_sign_oca/models/res_company.py
@@ -0,0 +1,14 @@
+# Copyright 2024 - TODAY, Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from odoo import fields, models
+
+
+class ResCompany(models.Model):
+    _inherit = "res.company"
+
+    project_task_sign_oca_template_id = fields.Many2one(
+        comodel_name="sign.oca.template",
+        domain="[('model_id.model', '=', 'project.task')]",
+        string="Project Task Sign Oca Template",
+    )
diff --git a/project_task_sign_oca/models/res_config_settings.py b/project_task_sign_oca/models/res_config_settings.py
new file mode 100644
index 00000000..4ca65732
--- /dev/null
+++ b/project_task_sign_oca/models/res_config_settings.py
@@ -0,0 +1,15 @@
+# Copyright 2024 - TODAY, Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+# 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"
+
+    project_task_sign_oca_template_id = fields.Many2one(
+        comodel_name="sign.oca.template",
+        related="company_id.project_task_sign_oca_template_id",
+        string="Project Task Sign Oca Template",
+        readonly=False,
+    )
diff --git a/project_task_sign_oca/models/sign_oca_request.py b/project_task_sign_oca/models/sign_oca_request.py
new file mode 100644
index 00000000..29165de7
--- /dev/null
+++ b/project_task_sign_oca/models/sign_oca_request.py
@@ -0,0 +1,39 @@
+# Copyright 2024 - TODAY, Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+# 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"
+
+    task_id = fields.Many2one(
+        comodel_name="project.task",
+        string="Task",
+        compute="_compute_task_id",
+        readonly=True,
+        store=True,
+    )
+    project_id = fields.Many2one(
+        comodel_name="project.project",
+        string="Project",
+        compute="_compute_project_id",
+        compute_sudo=True,
+        readonly=True,
+        store=True,
+    )
+
+    @api.depends("record_ref")
+    def _compute_task_id(self):
+        for item in self.filtered(
+            lambda x: x.record_ref and x.record_ref._name == "project.task"
+        ):
+            item.task_id = item.record_ref.id
+
+    @api.depends("record_ref")
+    def _compute_project_id(self):
+        for item in self.filtered(
+            lambda x: x.record_ref and x.record_ref._name == "project.task"
+        ):
+            task = self.env["project.task"].browse(item.record_ref.id)
+            item.project_id = task.project_id
diff --git a/project_task_sign_oca/readme/CONFIGURE.rst b/project_task_sign_oca/readme/CONFIGURE.rst
new file mode 100644
index 00000000..47285ec0
--- /dev/null
+++ b/project_task_sign_oca/readme/CONFIGURE.rst
@@ -0,0 +1,14 @@
+#. Go to Sign > Roles and create a role with the following data:
+
+- Partner type: Expression
+- Expression: ${object.partner_id.id}
+
+#. Go to Sign > Templates and create a template with the following data:
+
+- Model: Project Task
+- In one of the fields, you must set the previously created role.
+
+#. (Optional) Go to Project > Configuration > Settings.
+
+- In the Task Sign section, define a template to enable automatic task sing requests.
+- Use the template previously created.
diff --git a/project_task_sign_oca/readme/CONTRIBUTORS.rst b/project_task_sign_oca/readme/CONTRIBUTORS.rst
new file mode 100644
index 00000000..bc15bdce
--- /dev/null
+++ b/project_task_sign_oca/readme/CONTRIBUTORS.rst
@@ -0,0 +1,4 @@
+* `Escodoo <https://www.escodoo.com.br>`_:
+
+  * Marcel Savegnago <marcel.savegnago@escodoo.com.br>
+  * Wesley Oliveira <wesley.oliveira@escodoo.com.br>
diff --git a/project_task_sign_oca/readme/DESCRIPTION.rst b/project_task_sign_oca/readme/DESCRIPTION.rst
new file mode 100644
index 00000000..db9767d5
--- /dev/null
+++ b/project_task_sign_oca/readme/DESCRIPTION.rst
@@ -0,0 +1,1 @@
+This module allows you to generate manual and automatic signature requests from project tasks to task customers.
diff --git a/project_task_sign_oca/readme/USAGE.rst b/project_task_sign_oca/readme/USAGE.rst
new file mode 100644
index 00000000..ba7585fe
--- /dev/null
+++ b/project_task_sign_oca/readme/USAGE.rst
@@ -0,0 +1,17 @@
+Creating a Signature Request from a Project Task:
+- Go to Projects > Tasks.
+- Open an existing task or create a new one (make sure to fill in the `partner_id` field).
+- In the task tree or form view, click on the action "Sign from template".
+- Sign Requests will have been generated (and sent) linked to the selected project and task.
+
+Automatic Signature Request creation:
+- Define a template in Project > Configuration > Settings.
+- When an customer is assigned to a task, a Sign Request will be created (and sent) automatically.
+
+Viewing Signature Requests:
+- Go to Projects > Tasks.
+- Open a task with an associated signature request.
+- Click on the smart-button Sign Requests.
+- Click on any signature request to view its details, status, and progress.
+- Alternatively, go to Sign > Requests.
+- Use the Group By feature to group requests by Project and/or Task.
diff --git a/project_task_sign_oca/static/description/icon.png b/project_task_sign_oca/static/description/icon.png
new file mode 100644
index 00000000..3a0328b5
Binary files /dev/null and b/project_task_sign_oca/static/description/icon.png differ
diff --git a/project_task_sign_oca/static/description/index.html b/project_task_sign_oca/static/description/index.html
new file mode 100644
index 00000000..b8ea0f83
--- /dev/null
+++ b/project_task_sign_oca/static/description/index.html
@@ -0,0 +1,471 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
+<title>Project Task Sign Oca</title>
+<style type="text/css">
+
+/*
+:Author: David Goodger (goodger@python.org)
+:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
+:Copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+Despite the name, some widely supported CSS2 features are used.
+
+See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
+customize this style sheet.
+*/
+
+/* used to remove borders from tables and images */
+.borderless, table.borderless td, table.borderless th {
+  border: 0 }
+
+table.borderless td, table.borderless th {
+  /* Override padding for "table.docutils td" with "! important".
+     The right padding separates the table cells. */
+  padding: 0 0.5em 0 0 ! important }
+
+.first {
+  /* Override more specific margin styles with "! important". */
+  margin-top: 0 ! important }
+
+.last, .with-subtitle {
+  margin-bottom: 0 ! important }
+
+.hidden {
+  display: none }
+
+.subscript {
+  vertical-align: sub;
+  font-size: smaller }
+
+.superscript {
+  vertical-align: super;
+  font-size: smaller }
+
+a.toc-backref {
+  text-decoration: none ;
+  color: black }
+
+blockquote.epigraph {
+  margin: 2em 5em ; }
+
+dl.docutils dd {
+  margin-bottom: 0.5em }
+
+object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
+  overflow: hidden;
+}
+
+/* Uncomment (and remove this text!) to get bold-faced definition list terms
+dl.docutils dt {
+  font-weight: bold }
+*/
+
+div.abstract {
+  margin: 2em 5em }
+
+div.abstract p.topic-title {
+  font-weight: bold ;
+  text-align: center }
+
+div.admonition, div.attention, div.caution, div.danger, div.error,
+div.hint, div.important, div.note, div.tip, div.warning {
+  margin: 2em ;
+  border: medium outset ;
+  padding: 1em }
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title {
+  font-weight: bold ;
+  font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title, .code .error {
+  color: red ;
+  font-weight: bold ;
+  font-family: sans-serif }
+
+/* Uncomment (and remove this text!) to get reduced vertical space in
+   compound paragraphs.
+div.compound .compound-first, div.compound .compound-middle {
+  margin-bottom: 0.5em }
+
+div.compound .compound-last, div.compound .compound-middle {
+  margin-top: 0.5em }
+*/
+
+div.dedication {
+  margin: 2em 5em ;
+  text-align: center ;
+  font-style: italic }
+
+div.dedication p.topic-title {
+  font-weight: bold ;
+  font-style: normal }
+
+div.figure {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+div.footer, div.header {
+  clear: both;
+  font-size: smaller }
+
+div.line-block {
+  display: block ;
+  margin-top: 1em ;
+  margin-bottom: 1em }
+
+div.line-block div.line-block {
+  margin-top: 0 ;
+  margin-bottom: 0 ;
+  margin-left: 1.5em }
+
+div.sidebar {
+  margin: 0 0 0.5em 1em ;
+  border: medium outset ;
+  padding: 1em ;
+  background-color: #ffffee ;
+  width: 40% ;
+  float: right ;
+  clear: right }
+
+div.sidebar p.rubric {
+  font-family: sans-serif ;
+  font-size: medium }
+
+div.system-messages {
+  margin: 5em }
+
+div.system-messages h1 {
+  color: red }
+
+div.system-message {
+  border: medium outset ;
+  padding: 1em }
+
+div.system-message p.system-message-title {
+  color: red ;
+  font-weight: bold }
+
+div.topic {
+  margin: 2em }
+
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+  margin-top: 0.4em }
+
+h1.title {
+  text-align: center }
+
+h2.subtitle {
+  text-align: center }
+
+hr.docutils {
+  width: 75% }
+
+img.align-left, .figure.align-left, object.align-left, table.align-left {
+  clear: left ;
+  float: left ;
+  margin-right: 1em }
+
+img.align-right, .figure.align-right, object.align-right, table.align-right {
+  clear: right ;
+  float: right ;
+  margin-left: 1em }
+
+img.align-center, .figure.align-center, object.align-center {
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+
+table.align-center {
+  margin-left: auto;
+  margin-right: auto;
+}
+
+.align-left {
+  text-align: left }
+
+.align-center {
+  clear: both ;
+  text-align: center }
+
+.align-right {
+  text-align: right }
+
+/* reset inner alignment in figures */
+div.align-right {
+  text-align: inherit }
+
+/* div.align-center * { */
+/*   text-align: left } */
+
+.align-top    {
+  vertical-align: top }
+
+.align-middle {
+  vertical-align: middle }
+
+.align-bottom {
+  vertical-align: bottom }
+
+ol.simple, ul.simple {
+  margin-bottom: 1em }
+
+ol.arabic {
+  list-style: decimal }
+
+ol.loweralpha {
+  list-style: lower-alpha }
+
+ol.upperalpha {
+  list-style: upper-alpha }
+
+ol.lowerroman {
+  list-style: lower-roman }
+
+ol.upperroman {
+  list-style: upper-roman }
+
+p.attribution {
+  text-align: right ;
+  margin-left: 50% }
+
+p.caption {
+  font-style: italic }
+
+p.credits {
+  font-style: italic ;
+  font-size: smaller }
+
+p.label {
+  white-space: nowrap }
+
+p.rubric {
+  font-weight: bold ;
+  font-size: larger ;
+  color: maroon ;
+  text-align: center }
+
+p.sidebar-title {
+  font-family: sans-serif ;
+  font-weight: bold ;
+  font-size: larger }
+
+p.sidebar-subtitle {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+p.topic-title {
+  font-weight: bold }
+
+pre.address {
+  margin-bottom: 0 ;
+  margin-top: 0 ;
+  font: inherit }
+
+pre.literal-block, pre.doctest-block, pre.math, pre.code {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+pre.code .ln { color: gray; } /* line numbers */
+pre.code, code { background-color: #eeeeee }
+pre.code .comment, code .comment { color: #5C6576 }
+pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
+pre.code .literal.string, code .literal.string { color: #0C5404 }
+pre.code .name.builtin, code .name.builtin { color: #352B84 }
+pre.code .deleted, code .deleted { background-color: #DEB0A1}
+pre.code .inserted, code .inserted { background-color: #A3D289}
+
+span.classifier {
+  font-family: sans-serif ;
+  font-style: oblique }
+
+span.classifier-delimiter {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+span.interpreted {
+  font-family: sans-serif }
+
+span.option {
+  white-space: nowrap }
+
+span.pre {
+  white-space: pre }
+
+span.problematic, pre.problematic {
+  color: red }
+
+span.section-subtitle {
+  /* font-size relative to parent (h1..h6 element) */
+  font-size: 80% }
+
+table.citation {
+  border-left: solid 1px gray;
+  margin-left: 1px }
+
+table.docinfo {
+  margin: 2em 4em }
+
+table.docutils {
+  margin-top: 0.5em ;
+  margin-bottom: 0.5em }
+
+table.footnote {
+  border-left: solid 1px black;
+  margin-left: 1px }
+
+table.docutils td, table.docutils th,
+table.docinfo td, table.docinfo th {
+  padding-left: 0.5em ;
+  padding-right: 0.5em ;
+  vertical-align: top }
+
+table.docutils th.field-name, table.docinfo th.docinfo-name {
+  font-weight: bold ;
+  text-align: left ;
+  white-space: nowrap ;
+  padding-left: 0 }
+
+/* "booktabs" style (no vertical lines) */
+table.docutils.booktabs {
+  border: 0px;
+  border-top: 2px solid;
+  border-bottom: 2px solid;
+  border-collapse: collapse;
+}
+table.docutils.booktabs * {
+  border: 0px;
+}
+table.docutils.booktabs th {
+  border-bottom: thin solid;
+  text-align: left;
+}
+
+h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
+h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
+  font-size: 100% }
+
+ul.auto-toc {
+  list-style-type: none }
+
+</style>
+</head>
+<body>
+<div class="document" id="project-task-sign-oca">
+<h1 class="title">Project Task Sign Oca</h1>
+
+<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! This file is generated by oca-gen-addon-readme !!
+!! changes will be overwritten.                   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! source digest: sha256:29657adda23cf1e28d4658aefc324414ea987077225edc3677ea4b77519d4bf5
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
+<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sign/tree/14.0/project_task_sign_oca"><img alt="OCA/sign" src="https://img.shields.io/badge/github-OCA%2Fsign-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sign-14-0/sign-14-0-project_task_sign_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sign&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
+<p>This module allows you to generate manual and automatic signature requests from project tasks to task customers.</p>
+<p><strong>Table of contents</strong></p>
+<div class="contents local topic" id="contents">
+<ul class="simple">
+<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
+<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
+<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
+<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
+<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
+<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
+<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
+</ul>
+</li>
+</ul>
+</div>
+<div class="section" id="configuration">
+<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
+<ol class="arabic simple">
+<li>Go to Sign &gt; Roles and create a role with the following data:</li>
+</ol>
+<ul class="simple">
+<li>Partner type: Expression</li>
+<li>Expression: ${object.partner_id.id}</li>
+</ul>
+<ol class="arabic simple">
+<li>Go to Sign &gt; Templates and create a template with the following data:</li>
+</ol>
+<ul class="simple">
+<li>Model: Project Task</li>
+<li>In one of the fields, you must set the previously created role.</li>
+</ul>
+<ol class="arabic simple">
+<li>(Optional) Go to Project &gt; Configuration &gt; Settings.</li>
+</ol>
+<ul class="simple">
+<li>In the Task Sign section, define a template to enable automatic task sing requests.</li>
+<li>Use the template previously created.</li>
+</ul>
+</div>
+<div class="section" id="usage">
+<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
+<p>Creating a Signature Request from a Project Task:
+- Go to Projects &gt; Tasks.
+- Open an existing task or create a new one (make sure to fill in the <cite>partner_id</cite> field).
+- In the task tree or form view, click on the action “Sign from template”.
+- Sign Requests will have been generated (and sent) linked to the selected project and task.</p>
+<p>Automatic Signature Request creation:
+- Define a template in Project &gt; Configuration &gt; Settings.
+- When an customer is assigned to a task, a Sign Request will be created (and sent) automatically.</p>
+<p>Viewing Signature Requests:
+- Go to Projects &gt; Tasks.
+- Open a task with an associated signature request.
+- Click on the smart-button Sign Requests.
+- Click on any signature request to view its details, status, and progress.
+- Alternatively, go to Sign &gt; Requests.
+- Use the Group By feature to group requests by Project and/or Task.</p>
+</div>
+<div class="section" id="bug-tracker">
+<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
+<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sign/issues">GitHub Issues</a>.
+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
+<a class="reference external" href="https://github.com/OCA/sign/issues/new?body=module:%20project_task_sign_oca%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
+<p>Do not contact contributors directly about support or help with technical issues.</p>
+</div>
+<div class="section" id="credits">
+<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
+<div class="section" id="authors">
+<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
+<ul class="simple">
+<li>Escodoo</li>
+</ul>
+</div>
+<div class="section" id="contributors">
+<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
+<ul class="simple">
+<li><a class="reference external" href="https://www.escodoo.com.br">Escodoo</a>:<ul>
+<li>Marcel Savegnago &lt;<a class="reference external" href="mailto:marcel.savegnago&#64;escodoo.com.br">marcel.savegnago&#64;escodoo.com.br</a>&gt;</li>
+<li>Wesley Oliveira &lt;<a class="reference external" href="mailto:wesley.oliveira&#64;escodoo.com.br">wesley.oliveira&#64;escodoo.com.br</a>&gt;</li>
+</ul>
+</li>
+</ul>
+</div>
+<div class="section" id="maintainers">
+<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
+<p>This module is maintained by the OCA.</p>
+<a class="reference external image-reference" href="https://odoo-community.org">
+<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
+</a>
+<p>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.</p>
+<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sign/tree/14.0/project_task_sign_oca">OCA/sign</a> project on GitHub.</p>
+<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
+</div>
+</div>
+</div>
+</body>
+</html>
diff --git a/project_task_sign_oca/views/project_task.xml b/project_task_sign_oca/views/project_task.xml
new file mode 100644
index 00000000..e155320d
--- /dev/null
+++ b/project_task_sign_oca/views/project_task.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright 2024 - TODAY, Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+     License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
+<odoo>
+
+    <record id="view_task_form2" model="ir.ui.view">
+        <field name="name">project.task.form (in project_task_sign_oca)</field>
+        <field name="model">project.task</field>
+        <field name="inherit_id" ref="project.view_task_form2" />
+        <field
+            name="groups_id"
+            eval="[(6, 0, [ref('sign_oca.sign_oca_group_user')])]"
+        />
+        <field name="arch" type="xml">
+            <div name="button_box" position="inside">
+                <button
+                    type="object"
+                    name="action_view_sign_requests"
+                    class="oe_stat_button"
+                    icon="fa-file-text-o"
+                    attrs="{'invisible': [('sign_request_count', '=', 0)]}"
+                >
+                    <field
+                        name="sign_request_count"
+                        widget="statinfo"
+                        string="Sign Requests"
+                    />
+                </button>
+            </div>
+        </field>
+    </record>
+
+</odoo>
diff --git a/project_task_sign_oca/views/res_config_settings.xml b/project_task_sign_oca/views/res_config_settings.xml
new file mode 100644
index 00000000..ffbcc069
--- /dev/null
+++ b/project_task_sign_oca/views/res_config_settings.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright 2024 - TODAY, Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+     License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
+<odoo>
+
+    <record id="res_config_settings_view_form" model="ir.ui.view">
+        <field
+            name="name"
+        >res.config.settings.view.form.inherit.project (in project_task_sign_oca)</field>
+        <field name="model">res.config.settings</field>
+        <field name="priority" eval="90" />
+        <field name="inherit_id" ref="project.res_config_settings_view_form" />
+        <field name="arch" type="xml">
+            <div id="recurring_tasks_setting" position="after">
+                <div
+                    class="col-12 col-lg-6 o_setting_box"
+                    id="project_task_sign_oca_template_setting"
+                    groups="sign_oca.sign_oca_group_admin"
+                >
+                    <div class="o_setting_right_pane">
+                        <span class="o_form_label">Task Sign</span>
+                        <div class="text-muted">
+                            Define a template to enable automatic sign requests for the task customer
+                        </div>
+                        <div class="row mt16">
+                            <label
+                                for="project_task_sign_oca_template_id"
+                                string="Sign Template"
+                                class="col-lg-4 o_light_label"
+                            />
+                            <field
+                                name="project_task_sign_oca_template_id"
+                                options="{'no_create': True}"
+                                class="oe_inline"
+                            />
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </field>
+    </record>
+
+</odoo>
diff --git a/project_task_sign_oca/views/sign_oca_request.xml b/project_task_sign_oca/views/sign_oca_request.xml
new file mode 100644
index 00000000..20eb4d65
--- /dev/null
+++ b/project_task_sign_oca/views/sign_oca_request.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright 2024 - TODAY, Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+     License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
+<odoo>
+
+    <record id="sign_oca_request_search_view" model="ir.ui.view">
+        <field name="name">sign.oca.request.search (in project_task_sign_oca)</field>
+        <field name="model">sign.oca.request</field>
+        <field name="inherit_id" ref="sign_oca.sign_oca_request_search_view" />
+        <field name="groups_id" eval="[(6, 0, [ref('project.group_project_user')])]" />
+        <field name="arch" type="xml">
+            <field name="signer_ids" position="after">
+                <field name="project_id" />
+                <field name="task_id" />
+            </field>
+            <filter name="group_by_state" position="after">
+                <filter
+                    string="Project"
+                    name="group_by_project_id"
+                    context="{'group_by': 'project_id'}"
+                />
+                <filter
+                    string="Task"
+                    name="group_by_task_id"
+                    context="{'group_by': 'task_id'}"
+                />
+            </filter>
+        </field>
+    </record>
+
+    <record id="sign_oca_request_form_view" model="ir.ui.view">
+        <field name="name">sign.oca.request.form (in project_task_sign_oca)</field>
+        <field name="model">sign.oca.request</field>
+        <field name="inherit_id" ref="sign_oca.sign_oca_request_form_view" />
+        <field name="groups_id" eval="[(6, 0, [ref('project.group_project_user')])]" />
+        <field name="arch" type="xml">
+            <field name="record_ref" position="before">
+                <field
+                    name="project_id"
+                    readonly="1"
+                    attrs="{'invisible': [('project_id','=',False)]}"
+                />
+            </field>
+        </field>
+    </record>
+
+    <record id="sign_oca_request_tree_view" model="ir.ui.view">
+        <field name="name">sign.oca.request.tree (in project_task_sign_oca)</field>
+        <field name="model">sign.oca.request</field>
+        <field name="inherit_id" ref="sign_oca.sign_oca_request_tree_view" />
+        <field name="groups_id" eval="[(6, 0, [ref('project.group_project_user')])]" />
+        <field name="arch" type="xml">
+            <field name="record_ref" position="before">
+                <field name="project_id" optional="hide" />
+            </field>
+        </field>
+    </record>
+
+</odoo>
diff --git a/setup/project_task_sign_oca/odoo/addons/project_task_sign_oca b/setup/project_task_sign_oca/odoo/addons/project_task_sign_oca
new file mode 120000
index 00000000..49f1f4b3
--- /dev/null
+++ b/setup/project_task_sign_oca/odoo/addons/project_task_sign_oca
@@ -0,0 +1,1 @@
+../../../../project_task_sign_oca
\ No newline at end of file
diff --git a/setup/project_task_sign_oca/setup.py b/setup/project_task_sign_oca/setup.py
new file mode 100644
index 00000000..28c57bb6
--- /dev/null
+++ b/setup/project_task_sign_oca/setup.py
@@ -0,0 +1,6 @@
+import setuptools
+
+setuptools.setup(
+    setup_requires=['setuptools-odoo'],
+    odoo_addon=True,
+)


Test patch:
diff --git a/project_task_sign_oca/tests/__init__.py b/project_task_sign_oca/tests/__init__.py
new file mode 100644
index 00000000..fad82f87
--- /dev/null
+++ b/project_task_sign_oca/tests/__init__.py
@@ -0,0 +1,1 @@
+from . import test_project_task_sign_oca
diff --git a/project_task_sign_oca/tests/test_project_task_sign_oca.py b/project_task_sign_oca/tests/test_project_task_sign_oca.py
new file mode 100644
index 00000000..3d90b957
--- /dev/null
+++ b/project_task_sign_oca/tests/test_project_task_sign_oca.py
@@ -0,0 +1,109 @@
+# Copyright 2024 - TODAY, Wesley Oliveira <wesley.oliveira@escodoo.com.br>
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from odoo.tests.common import Form, SavepointCase
+
+
+class TestProjectTaskSignOca(SavepointCase):
+    @classmethod
+    def setUpClass(cls):
+        super().setUpClass()
+        cls.company_id = cls.env.company
+        cls.template = cls.env.ref(
+            "project_task_sign_oca.sign_oca_template_project_task_demo"
+        )
+        cls.customer_a = cls.env["res.partner"].create(
+            {
+                "name": "Test Customer A",
+            }
+        )
+        cls.customer_b = cls.env["res.partner"].create(
+            {
+                "name": "Test Customer B",
+            }
+        )
+        cls.project_a = cls.env["project.project"].create(
+            {
+                "name": "Test Project A",
+            }
+        )
+        cls.project_b = cls.env["project.project"].create(
+            {
+                "name": "Test Project B",
+            }
+        )
+        cls.task_a = cls.env["project.task"].create(
+            {
+                "name": "Test Task A",
+                "project_id": cls.project_a.id,
+                "partner_id": cls.customer_a.id,
+                "company_id": cls.company_id.id,
+            }
+        )
+        cls.task_b = cls.env["project.task"].create(
+            {
+                "name": "Test Task B",
+                "project_id": cls.project_b.id,
+                "partner_id": cls.customer_b.id,
+                "company_id": cls.company_id.id,
+            }
+        )
+
+    def test_template_generate_multi_project_task(self):
+        tasks = self.task_a + self.task_b
+        wizard_form = Form(
+            self.env["sign.oca.template.generate.multi"].with_context(
+                default_model="project.task", active_ids=tasks.ids
+            )
+        )
+        wizard_form.template_id = self.template
+        action = wizard_form.save().generate()
+        requests = self.env[action["res_model"]].search(action["domain"])
+        self.assertEqual(len(requests), 2)
+        request_a = requests.filtered(lambda x: x.task_id == self.task_a)
+        request_b = requests.filtered(lambda x: x.task_id == self.task_b)
+        self.assertIn(self.customer_a, request_a.mapped("signer_ids.partner_id"))
+        self.assertIn(self.customer_b, request_b.mapped("signer_ids.partner_id"))
+
+    def test_project_task_create(self):
+        self.company_id.project_task_sign_oca_template_id = self.template
+        task_c = self.env["project.task"].create(
+            {
+                "name": "Test Task C",
+                "project_id": self.project_a.id,
+                "partner_id": self.customer_a.id,
+                "company_id": self.company_id.id,
+            }
+        )
+        self.assertIn(
+            self.customer_a,
+            task_c.sign_request_ids.mapped("signer_ids.partner_id"),
+        )
+        self.assertEqual(task_c.sign_request_count, 1)
+        self.assertEqual(task_c.sign_request_ids[0].task_id, task_c)
+        self.assertEqual(task_c.sign_request_ids[0].project_id, self.project_a)
+
+    def test_project_task_write(self):
+        self.company_id.project_task_sign_oca_template_id = self.template
+        task_d = self.env["project.task"].create(
+            {
+                "name": "Test Task D",
+                "project_id": self.project_a.id,
+                "partner_id": False,
+                "company_id": self.company_id.id,
+            }
+        )
+        self.assertFalse(task_d.sign_request_ids)
+        self.assertEqual(task_d.sign_request_count, 0)
+        task_d.write({"partner_id": self.customer_a.id})
+        self.assertIn(
+            self.customer_a,
+            task_d.sign_request_ids.mapped("signer_ids.partner_id"),
+        )
+        self.assertEqual(task_d.sign_request_count, 1)
+        task_d.write({"partner_id": self.customer_b.id})
+        self.assertIn(
+            self.customer_b,
+            task_d.sign_request_ids.mapped("signer_ids.partner_id"),
+        )
+        self.assertEqual(task_d.sign_request_count, 2)