Browse Source

Merge pull request #108 from LasLabs/10.0-mig-contract_digitized_signature

[10.0][MIG] contract_digitized_signature
pull/133/head
Dave Lasley 7 years ago
committed by GitHub
parent
commit
438017f89e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 66
      contract_digitized_signature/README.rst
  2. 4
      contract_digitized_signature/__init__.py
  3. 23
      contract_digitized_signature/__manifest__.py
  4. 36
      contract_digitized_signature/i18n/es.po
  5. 4
      contract_digitized_signature/models/__init__.py
  6. 31
      contract_digitized_signature/models/account_analytic_account.py
  7. 19
      contract_digitized_signature/report/report_contract.xml
  8. BIN
      contract_digitized_signature/static/description/icon.png
  9. 4
      contract_digitized_signature/tests/__init__.py
  10. 23
      contract_digitized_signature/tests/test_contract_tracking.py
  11. 21
      contract_digitized_signature/views/contract_views.xml
  12. 1
      oca_dependencies.txt

66
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
<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.

4
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

23
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,
}

36
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 "<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"

4
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

31
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)

19
contract_digitized_signature/report/report_contract.xml

@ -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>

BIN
contract_digitized_signature/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 5.6 KiB

4
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

23
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)

21
contract_digitized_signature/views/contract_views.xml

@ -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>

1
oca_dependencies.txt

@ -1,2 +1,3 @@
bank-payment bank-payment
sale-workflow sale-workflow
web
Loading…
Cancel
Save