From 229a76aac7231ccb4b37806741d7d261e2daff0f Mon Sep 17 00:00:00 2001 From: cubells Date: Thu, 19 Oct 2017 16:45:39 +0200 Subject: [PATCH 1/4] [ADD] contract_digitized_signature (#102) * [ADD] contract_digitized_signature * Correct README and add signature_name * Change to char field * Improve tests to acchieve full coverage --- contract_digitized_signature/README.rst | 66 ++++++++++++++++++ contract_digitized_signature/__init__.py | 4 ++ contract_digitized_signature/__openerp__.py | 23 ++++++ contract_digitized_signature/i18n/es.po | 36 ++++++++++ .../models/__init__.py | 4 ++ .../models/account_analytic_account.py | 30 ++++++++ .../report/report_contract.xml | 19 +++++ .../static/description/icon.png | Bin 0 -> 5691 bytes .../tests/__init__.py | 4 ++ .../tests/test_contract_tracking.py | 23 ++++++ .../views/contract_views.xml | 21 ++++++ 11 files changed, 230 insertions(+) create mode 100644 contract_digitized_signature/README.rst create mode 100644 contract_digitized_signature/__init__.py create mode 100644 contract_digitized_signature/__openerp__.py create mode 100644 contract_digitized_signature/i18n/es.po create mode 100644 contract_digitized_signature/models/__init__.py create mode 100644 contract_digitized_signature/models/account_analytic_account.py create mode 100644 contract_digitized_signature/report/report_contract.xml create mode 100644 contract_digitized_signature/static/description/icon.png create mode 100644 contract_digitized_signature/tests/__init__.py create mode 100644 contract_digitized_signature/tests/test_contract_tracking.py create mode 100644 contract_digitized_signature/views/contract_views.xml diff --git a/contract_digitized_signature/README.rst b/contract_digitized_signature/README.rst new file mode 100644 index 00000000..59b63f00 --- /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/9.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/__openerp__.py b/contract_digitized_signature/__openerp__.py new file mode 100644 index 00000000..eeffb58b --- /dev/null +++ b/contract_digitized_signature/__openerp__.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": "9.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..f1a49192 --- /dev/null +++ b/contract_digitized_signature/models/account_analytic_account.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp 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 0000000000000000000000000000000000000000..b9e1b8dff7049ef3e8bdb5c73140b1cca781ad96 GIT binary patch literal 5691 zcmV-B7R2d^P)VEy+Z|3*y_g??{ z9YC5iY0{*bp-`#~PzxbIo`#xyq2u!zr%FM{B|$bp!b*Z{oM2-RRsi52HxqCP5-t+t z4*idtL}=rBsm-!>cP9}sm$pb=$Mt1`XdMAdxe)Ui(R=`Qg^K9sLbNfW zHUS)ijGY!&{xRCRT~;Xnlrbd*AOy(WRJ)i#uHz7OOrREwWol{!=e?Ybcti%Ba0?~bZsF6dtc7oTK|Wu)4kWZ;|+ z5V2>Oz|-c<%~w)wPb4Ot00wqcSIV3o=YnrzjOkKsj}mZ>00aLWgYGHQ=G|vgZO=$1 zjR1TNwdFFCzb!yp7{F3(j~Z}*Ga+7N3{RLgwwzD3J-{RofY?==;T`0UbK;LPFk`Ci z(SqAe!*|TGZ}UI3$6T9-Y!;nxZDuz6F>Bzo%80SrbRNU#}@3N&Eqzby}3iA)$jW!2oO% z%14g@6tW|b5KzdnI1zY*OZrD_8+LZ8U6kqqa5q#fC5G1lR-krSLmZbMLZ`S(k-Rc- z87p+ZQzWlM;2c*$Y_qL?_i;7LQT2J-+gNiSF}6ob=L0~GQ0_HBKNTvLS0XT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-*1FozAF>R8Tg0JnQ4vDm_?4?zU0H@DbBnN| zY%cUV35U*Kg41Tf{xcU)voN&ZPes8je6;Ew49YUL?>mT7?bpNd3I>DFOS<8-YQn*< z$g+4e(opY2m~eO1wqa+dtFd-7c(7T?$s~rk#gH-`kbC>!J9rqT_pg9tx54?zk4L@6 z`?mw&9xtTq_(Q@(guy@%Vnoxjblx2N>dj`9=H)?>7|f$OcXt=h#-gGEynFd7UO)UU z@|_OkI~)jd0fSDHb%?tKq8q_Z{FD2!U$XWcvD^zz*tra^QwCQA<+MN zBl=(cKLoFL-027kfxxwE==<}laPJ5Wd$-iA8E!t}B`?!~^PP95&EM>IBim-h$JedF zY-j9BO=1j{h51-__d=KqDmx!sCPp7IZ``v_sXP^pSXk;?Uv)QCe;UBA70a_~HJI59 z&z@%ZPoIVV^jVNz2bPfm+2;d-A-$1a2kW|8WZZpM!ez|M%fXQgm$9fQbhlsa>Oo0v z&Nx?T4-x*sx^d5IO6I9}$jZ8@ z{AS@l-Srs&E8|Ju@>=Zn{SLE$q6ocf4}d+9gG7lS0znK82GQNohn9ELTTQfNQ66T` zi?5@~Ief&Vk0^cT520Gny3=R85%2Wo>IW96WyX{y5F{UCyw0+z^=-AvnC@#sPig*q zDf72#Iv+?2U{Z6{V^n?N&XnyJ@W{8m51mTWp{5F)F~F|faIr|FL;(7tc^Cwc(8z@} zs*r91W;kg9%y7~InBk-aFvCd;V1|!eu4Wn25fTV+o&GO9zx~mb hRNIm!O`7S<{{z8^#@=5bJEH&q002ovPDHLkV1fb9ucH6} literal 0 HcmV?d00001 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..d4f562ae --- /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 openerp.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 + + + + + + + +
+
diff --git a/contract_digitized_signature/static/description/index.html b/contract_digitized_signature/static/description/index.html new file mode 100644 index 00000000..6365d64b --- /dev/null +++ b/contract_digitized_signature/static/description/index.html @@ -0,0 +1,423 @@ + + + + + + +Contract Digitized Signature + + + +
+

Contract Digitized Signature

+ + +

Beta License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runbot

+

This module adds a signature field to contract report.

+

Table of contents

+ +
+

Installation

+

This module depends on :

+
    +
  • web_widget_digitized_signature
  • +
+

This module is part of the OCA/web suite.

+
+
+

Usage

+
    +
  1. Go to Sales > Sales > Contracts and edit or create a contract.
  2. +
  3. You will see a box ready to write a signature by your customer.
  4. +
  5. Save Contract.
  6. +
  7. Every time you modify signature, a message is saved in chatter to log any +changes on it.
  8. +
  9. You can clear signature in any moment by clicking on the Clear link +located on the top right side of signature box.
  10. +
  11. If you print the Contract, signature was added to contact report.
  12. +
+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/contract project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/contract_digitized_signature/tests/__init__.py b/contract_digitized_signature/tests/__init__.py index 7b5b3e9c..e62c461a 100644 --- a/contract_digitized_signature/tests/__init__.py +++ b/contract_digitized_signature/tests/__init__.py @@ -1,4 +1 @@ -# -*- 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 index 3319a5cb..ce1498d8 100644 --- a/contract_digitized_signature/tests/test_contract_tracking.py +++ b/contract_digitized_signature/tests/test_contract_tracking.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/oca_dependencies.txt b/oca_dependencies.txt index 34f82ae9..398b9810 100644 --- a/oca_dependencies.txt +++ b/oca_dependencies.txt @@ -1 +1,2 @@ bank-payment +web