diff --git a/contract_digitized_signature/README.rst b/contract_digitized_signature/README.rst new file mode 100644 index 00000000..d9770d5e --- /dev/null +++ b/contract_digitized_signature/README.rst @@ -0,0 +1,66 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============================ +Contract Digitized Signature +============================ + +This module adds a signature field to contract report. + +Installation +============ + +This module depends on : + +* web_widget_digitized_signature + +This module is part of the OCA/web suite. + +Usage +===== + +#. Go to **Sales > Sales > Contracts** and edit or create a contract. +#. You will see a box ready to write a signature by your customer. +#. Save Contract. +#. Every time you modify signature, a message is saved in chatter to log any + changes on it. +#. You can clear signature in any moment by clicking on the **Clear** link + located on the top right side of signature box. +#. If you print the Contract, signature was added to contact report. + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/110/10.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Vicent Cubells + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/contract_digitized_signature/__init__.py b/contract_digitized_signature/__init__.py new file mode 100644 index 00000000..ec50cfc0 --- /dev/null +++ b/contract_digitized_signature/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/contract_digitized_signature/__manifest__.py b/contract_digitized_signature/__manifest__.py new file mode 100644 index 00000000..a59da1b5 --- /dev/null +++ b/contract_digitized_signature/__manifest__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Contract Digitized Signature", + "version": "10.0.1.0.0", + "author": "Tecnativa, " + "Odoo Community Association (OCA)", + "website": "https://www.tecnativa.com", + "category": "Contract Management", + "license": "AGPL-3", + "depends": [ + "contract", + "sale", + "web_widget_digitized_signature", + ], + "data": [ + "report/report_contract.xml", + "views/contract_views.xml", + ], + "installable": True, +} diff --git a/contract_digitized_signature/i18n/es.po b/contract_digitized_signature/i18n/es.po new file mode 100644 index 00000000..5a5c999c --- /dev/null +++ b/contract_digitized_signature/i18n/es.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_digitized_signature +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-10-16 08:32+0000\n" +"PO-Revision-Date: 2017-10-16 08:32+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: contract_digitized_signature +#: model:ir.ui.view,arch_db:contract_digitized_signature.report_contract_document +msgid "Customer acceptance:" +msgstr "Aceptación de cliente:" + +#. module: contract_digitized_signature +#: model:ir.model,name:contract_digitized_signature.model_account_analytic_account +msgid "Analytic Account" +msgstr "Contrato" + +#. module: contract_digitized_signature +#: model:ir.model.fields,field_description:contract_digitized_signature.field_account_analytic_account_customer_signature +msgid "Customer acceptance" +msgstr "Aceptación de cliente" + +#. module: contract_digitized_signature +#: model:ir.model.fields,field_description:contract_digitized_signature.field_account_analytic_account_signature_name +msgid "Signed by" +msgstr "Firmado por" diff --git a/contract_digitized_signature/models/__init__.py b/contract_digitized_signature/models/__init__.py new file mode 100644 index 00000000..16b0e7be --- /dev/null +++ b/contract_digitized_signature/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import account_analytic_account diff --git a/contract_digitized_signature/models/account_analytic_account.py b/contract_digitized_signature/models/account_analytic_account.py new file mode 100644 index 00000000..35e63507 --- /dev/null +++ b/contract_digitized_signature/models/account_analytic_account.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class AccountAnalyticAccount(models.Model): + + _name = 'account.analytic.account' + _inherit = ['account.analytic.account', 'mail.thread'] + + customer_signature = fields.Binary( + string='Customer acceptance', + ) + signature_name = fields.Char( + string='Signed by', + ) + + @api.model + def create(self, values): + contract = super(AccountAnalyticAccount, self).create(values) + if contract.customer_signature: + values = {'customer_signature': contract.customer_signature} + contract._track_signature(values, 'customer_signature') + return contract + + @api.multi + def write(self, values): + self._track_signature(values, 'customer_signature') + return super(AccountAnalyticAccount, self).write(values) diff --git a/contract_digitized_signature/report/report_contract.xml b/contract_digitized_signature/report/report_contract.xml new file mode 100644 index 00000000..9fbc5164 --- /dev/null +++ b/contract_digitized_signature/report/report_contract.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/contract_digitized_signature/static/description/icon.png b/contract_digitized_signature/static/description/icon.png new file mode 100644 index 00000000..b9e1b8df Binary files /dev/null and b/contract_digitized_signature/static/description/icon.png differ diff --git a/contract_digitized_signature/tests/__init__.py b/contract_digitized_signature/tests/__init__.py new file mode 100644 index 00000000..7b5b3e9c --- /dev/null +++ b/contract_digitized_signature/tests/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_contract_tracking diff --git a/contract_digitized_signature/tests/test_contract_tracking.py b/contract_digitized_signature/tests/test_contract_tracking.py new file mode 100644 index 00000000..3319a5cb --- /dev/null +++ b/contract_digitized_signature/tests/test_contract_tracking.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests import common + + +class TestContractSignatureTracking(common.SavepointCase): + @classmethod + def setUpClass(cls): + super(TestContractSignatureTracking, cls).setUpClass() + # Simple 1x1 transparent base64 encoded GIF + cls.image = 'R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' + + def test_contract_signature_tracking(self): + self.contract = self.env['account.analytic.account'].create({ + 'name': 'Test Contract', + 'customer_signature': self.image, + }) + message = self.env['mail.message'].search([ + ('res_id', '=', self.contract.id) + ], order='id desc', limit=1) + self.assertIn('Signature has been created.', message.body) diff --git a/contract_digitized_signature/views/contract_views.xml b/contract_digitized_signature/views/contract_views.xml new file mode 100644 index 00000000..1aedfbe5 --- /dev/null +++ b/contract_digitized_signature/views/contract_views.xml @@ -0,0 +1,21 @@ + + + + + account.analytic.account.invoice.recurring.form.inherit + account.analytic.account + + + + + + + +
+