forked from ERPLibre/contract
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] contract_digitized_signature (OCA#102)
* [ADD] contract_digitized_signature * Correct README and add signature_name * Change to char field * Improve tests to acchieve full coverage
- Loading branch information
Showing
11 changed files
with
230 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
<https://github.com/OCA/contract/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 <vicent.cubells@tecnativa.com> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "<strong>Customer acceptance:</strong>" | ||
msgstr "<strong>Aceptación de cliente:</strong>" | ||
|
||
#. 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import account_analytic_account |
30 changes: 30 additions & 0 deletions
30
contract_digitized_signature/models/account_analytic_account.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" ?> | ||
<odoo> | ||
|
||
<template id="report_contract_document" inherit_id="contract.report_contract_document"> | ||
<xpath expr="//div[@id='invoice_info']" position="after"> | ||
<div class="row"> | ||
<div id="signature"> | ||
<p> | ||
<strong>Customer acceptance:</strong> | ||
<span t-if="o.customer_signature"> | ||
<img class="image" t-att-src="'data:image/png;base64,%s' % o.customer_signature" style="border:auto;"/> | ||
</span> | ||
</p> | ||
</div> | ||
</div> | ||
</xpath> | ||
</template> | ||
|
||
</odoo> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
23 changes: 23 additions & 0 deletions
23
contract_digitized_signature/tests/test_contract_tracking.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" ?> | ||
<odoo> | ||
|
||
<record id="account_analytic_account_recurring_form_form" model="ir.ui.view"> | ||
<field name="name">account.analytic.account.invoice.recurring.form.inherit</field> | ||
<field name="model">account.analytic.account</field> | ||
<field name="inherit_id" ref="contract.account_analytic_account_recurring_form_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="partner_id" position="after"> | ||
<field name="user_id"/> | ||
<field name="signature_name"/> | ||
</field> | ||
<xpath expr="//group[@name='group_legend']" position="after"> | ||
<div class="oe_clear"/> | ||
<label for="customer_signature" class="oe_edit_only"/> | ||
<field name="customer_signature" widget="signature"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |