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
76 changes: 76 additions & 0 deletions automation_sign_oca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
===================
Automation Sign Oca
===================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d082b45af8468122f4ec19c24cce26ace5a07bee0fe9b18b3443707cadff0045
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fautomation-lightgray.png?logo=github
:target: https://github.com/OCA/automation/tree/16.0/automation_sign_oca
:alt: OCA/automation
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/automation-16-0/automation-16-0-automation_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/automation&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to send signatures and check the finalization of it.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/automation/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/automation/issues/new?body=module:%20automation_sign_oca%0Aversion:%2016.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
------------

- Enric Tobella (`Dixmit <https://www.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/automation <https://github.com/OCA/automation/tree/16.0/automation_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 automation_sign_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions automation_sign_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Automation Sign Oca",
"summary": """Integration Sign and Automation""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Dixmit,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/automation",
"depends": [
"automation_oca",
"sign_oca",
],
"data": [
"views/automation_configuration_step.xml",
],
}
3 changes: 3 additions & 0 deletions automation_sign_oca/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import automation_configuration_step
from . import automation_record_step
from . import sign_oca_request
56 changes: 56 additions & 0 deletions automation_sign_oca/models/automation_configuration_step.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright 2025 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models


class AutomationConfigurationStep(models.Model):

_inherit = "automation.configuration.step"

step_type = fields.Selection(
selection_add=[("sign", "Sign")], ondelete={"sign": "cascade"}
)
sign_template_id = fields.Many2one("sign.oca.template")
sign_signer_partner_field_id = fields.Many2one(
"ir.model.fields",
domain="[('model_id', '=', model_id), ('relation', '=', 'res.partner')]",
string="Signer Partner Field",
)

@api.model
def _step_icons(self):
result = super()._step_icons()
result["sign"] = "fa fa-pencil-square-o"
return result

Check warning on line 25 in automation_sign_oca/models/automation_configuration_step.py

View check run for this annotation

Codecov / codecov/patch

automation_sign_oca/models/automation_configuration_step.py#L23-L25

Added lines #L23 - L25 were not covered by tests

@api.model
def _trigger_types(self):
result = super()._trigger_types()
result.update(
{
"sign_signed": {
"name": _("Signed"),
"allow_expiry": True,
"step_type": ["sign"],
"color": "text-success",
"icon": "fa fa-pencil-square-o",
"message_configuration": _("Signed after"),
"message": _("Not Signed yet"),
},
"sign_not_signed": {
"name": _("Not Signed"),
"step_type": ["sign"],
"color": "text-danger",
"icon": "fa fa-pencil-square-o",
"message_configuration": _("Not Signed within"),
"message": False,
},
}
)
return result

def _get_record_activity_scheduled_date(self):
if self.trigger_type in ["sign_signed"]:
return False
return super()._get_record_activity_scheduled_date()
75 changes: 75 additions & 0 deletions automation_sign_oca/models/automation_record_step.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright 2025 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, fields, models


class AutomationRecordStep(models.Model):

_inherit = "automation.record.step"

sign_signed_on = fields.Datetime(readonly=True)

def _run_sign_generate_vals(self):
record = self.env[self.record_id.model].browse(self.record_id.res_id)
return {
"automation_step_id": self.id,
"name": self.configuration_step_id.sign_template_id.name,
"template_id": self.configuration_step_id.sign_template_id.id,
"signatory_data": self.configuration_step_id.sign_template_id._get_signatory_data(),
"data": self.configuration_step_id.sign_template_id.data,
"ask_location": self.configuration_step_id.sign_template_id.ask_location,
"signer_ids": [
(
0,
0,
{
"partner_id": (
role.partner_selection_policy == "default"
and role.default_partner_id.id
)
or record[
self.configuration_step_id.sign_signer_partner_field_id.name
].id,
"role_id": role.id,
},
)
for role in self.configuration_step_id.sign_template_id.item_ids.role_id
],
}

def _run_sign(self):
request = self.env["sign.oca.request"].create(self._run_sign_generate_vals())
request.action_send()
self._fill_childs()

def _set_sign_signed(self):
self.filtered(lambda t: not t.sign_signed_on).write(
{"sign_signed_on": fields.Datetime.now()}
)
self.child_ids.filtered(
lambda r: r.trigger_type in ["sign_signed"]
and not r.scheduled_date
and r.state == "scheduled"
)._activate()

def _check_to_execute(self):
if (
self.configuration_step_id.trigger_type == "sign_not_signed"
and self.parent_id.sign_signed_on
):
return False
return super()._check_to_execute()

def _get_step_actions(self):
actions = super()._get_step_actions()

Check warning on line 65 in automation_sign_oca/models/automation_record_step.py

View check run for this annotation

Codecov / codecov/patch

automation_sign_oca/models/automation_record_step.py#L65

Added line #L65 was not covered by tests
if self.step_type == "sign":
actions.append(

Check warning on line 67 in automation_sign_oca/models/automation_record_step.py

View check run for this annotation

Codecov / codecov/patch

automation_sign_oca/models/automation_record_step.py#L67

Added line #L67 was not covered by tests
{
"icon": "fa fa-pencil-square-o",
"name": _("Signed"),
"done": bool(self.sign_signed_on),
"color": "text-success",
}
)
return actions

Check warning on line 75 in automation_sign_oca/models/automation_record_step.py

View check run for this annotation

Codecov / codecov/patch

automation_sign_oca/models/automation_record_step.py#L75

Added line #L75 was not covered by tests
19 changes: 19 additions & 0 deletions automation_sign_oca/models/sign_oca_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2025 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class SignOcaRequest(models.Model):

_inherit = "sign.oca.request"

automation_step_id = fields.Many2one(
"automation.record.step",
readonly=True,
)

def _signed_hook(self):
res = super()._signed_hook()
self.automation_step_id._set_sign_signed()
return res
1 change: 1 addition & 0 deletions automation_sign_oca/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Enric Tobella ([Dixmit](https://www.dixmit.com/))
1 change: 1 addition & 0 deletions automation_sign_oca/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows to send signatures and check the finalization of it.
Binary file added automation_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