Browse Source

[ADD] web_widget_digitized_signature

pull/666/head
cubells 7 years ago
committed by Pedro M. Baeza
parent
commit
36179dbbc0
  1. 17
      web_digital_sign/LICENSE/LICENSE
  2. 4
      web_digital_sign/__init__.py
  3. 34
      web_digital_sign/__openerp__.py
  4. BIN
      web_digital_sign/static/description/icon.png
  5. BIN
      web_digital_sign/static/description/img/1.png
  6. BIN
      web_digital_sign/static/description/img/2.png
  7. BIN
      web_digital_sign/static/description/img/3.png
  8. 68
      web_digital_sign/static/description/index.html
  9. 11
      web_digital_sign/users.py
  10. 17
      web_digital_sign/users_view.xml
  11. 13
      web_digital_sign/views/we_digital_sign_view.xml
  12. 70
      web_widget_digitized_signature/README.rst
  13. 6
      web_widget_digitized_signature/__init__.py
  14. 29
      web_widget_digitized_signature/__openerp__.py
  15. 79
      web_widget_digitized_signature/i18n/es.po
  16. 7
      web_widget_digitized_signature/models/__init__.py
  17. 40
      web_widget_digitized_signature/models/mail_thread.py
  18. 16
      web_widget_digitized_signature/models/res_users.py
  19. BIN
      web_widget_digitized_signature/static/description/icon.png
  20. 0
      web_widget_digitized_signature/static/lib/jSignature/jSignatureCustom.js
  21. 2
      web_widget_digitized_signature/static/src/js/digital_sign.js
  22. 4
      web_widget_digitized_signature/static/src/xml/digital_sign.xml
  23. 27
      web_widget_digitized_signature/views/res_users_view.xml
  24. 11
      web_widget_digitized_signature/views/web_digital_sign_view.xml

17
web_digital_sign/LICENSE/LICENSE

@ -1,17 +0,0 @@
OpenERP, Open Source Management Solution
Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
Copyright (C) 2011-2015 Serpent Consulting Services Pvt. Ltd. (<http://www.serpentcs.com>).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

4
web_digital_sign/__init__.py

@ -1,4 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import users

34
web_digital_sign/__openerp__.py

@ -1,34 +0,0 @@
# -*- coding: utf-8 -*-
# See LICENSE file for full copyright and licensing details.
{
"name" : "Web Digital Signature 9.0",
"version" : "9.0.1.0.0",
'author': 'Serpent Consulting Services Pvt. Ltd.',
"category": '',
'license': 'AGPL-3',
'complexity': "easy",
'depends': ['web'],
'description': '''
This module provides the functionality to store digital signature
for a record.
-> This module is helpfull to make your business process a little
bit more faster & makes it more user friendly by providing you
digital signature functionality on your documents.
-> It is touch screen enable so user can add signature with touch
devices.
-> Digital signature can be very usefull for documents such as
sale orders, purchase orders, inovoices, payslips, procurement
receipts, etc.
The example can be seen into the User's form view where we have
added a test field under signature.
''',
'data': [
'views/we_digital_sign_view.xml',
'users_view.xml'
],
'website': 'http://www.serpentcs.com',
'qweb': ['static/src/xml/digital_sign.xml'],
'installable': True,
'auto_install': False,
}

BIN
web_digital_sign/static/description/icon.png

Before

Width: 1147  |  Height: 564  |  Size: 20 KiB

BIN
web_digital_sign/static/description/img/1.png

Before

Width: 1600  |  Height: 900  |  Size: 188 KiB

BIN
web_digital_sign/static/description/img/2.png

Before

Width: 1600  |  Height: 900  |  Size: 188 KiB

BIN
web_digital_sign/static/description/img/3.png

Before

Width: 1600  |  Height: 900  |  Size: 179 KiB

68
web_digital_sign/static/description/index.html

@ -1,68 +0,0 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span10">
<h2 class="oe_slogan">Web Digital Signature</h2>
<h3 class="oe_slogan">This module provides the functionality to store digital signature for a record</h3>
<ul>
<li style="font-size: 18px;">This module is helpfull to make your business process a little bit more faster & makes it more user friendly by providing you digital signature functionality on your documents.</li>
<li style="font-size: 18px;">It is touch screen enable so user can add signature with touch devices.</li>
<li style="font-size: 18px;">Digital signature can be very usefull for documents such as sale orders, purchase orders, inovoices, payslips, procurement receipts, etc.</li>
</ul>
</div>
<div class="oe_span10">
<br/><br/>
<h2 class="oe_slogan">Usage</h3>
<h3 class="oe_slogan">To use this module, you need to add widget="signature" to your binary field in your view.</h3>
</div>
</section>
<section class="oe_container">
<div class="oe_row">
<div class="oe_span6">
<br/><br/>
<h3 class="oe_slogan">Digital Signature View</h3>
<p class='oe_mt32' style="font-size: 18px;">User can store their digital signature
in the binary field, as you can see image.
</div>
<div class="oe_span6">
<div class="oe_bg_img">
<img class="oe_picture oe_screenshot" src="img/1.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row">
<div class="oe_span6">
<div class="oe_bg_img">
<img class="oe_picture oe_screenshot" src="img/2.png">
</div>
</div>
<div class="oe_span6">
<h3 class="oe_slogan">Draw Signature</h3>
<p class='oe_mt32' style="font-size: 18px;">As shown in the image, user can add a signature using mouse, pen, or finger.</p>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row">
<div class="oe_span6">
<h3 class="oe_slogan">Clear Digital Signature</h3>
<p class='oe_mt32' style="font-size: 18px;">User can clear signature using clear button and it will re-initialize the signature.</p>
</div>
<div class="oe_span6">
<div class="oe_bg_img">
<img class="oe_picture oe_screenshot" src="img/3.png">
</div>
</div>
</div>
</section>
<section class="oe_container" style="background-color:#D21E14;padding-top:5px;">
<h2 class="oe_slogan" style="font-size:30px;color:#ffffff;padding-top: 25px;padding-bottom:10px;">For any questions, support and development</h2>
<p style="padding-bottom:25px;text-align:center;">
<span class="fa fa-envelope fa-1x" style="color:#ffffff;"></span>
<a style="color:#ffffff;font-weight:bold;" target="_blank" href="http://www.serpentcs.com/contact-us">&nbsp;Contact Us&nbsp;</a>
</p>
</section>

11
web_digital_sign/users.py

@ -1,11 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields, api
class Users(models.Model):
_name = 'res.users'
_inherit = 'res.users'
signature= fields.Binary(string='Signature')

17
web_digital_sign/users_view.xml

@ -1,17 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="inherited_res_users_form" model="ir.ui.view">
<field name="name">inherited.res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='signature']" position="after">
<label for="signature_image" class="oe_edit_only"/>
<h2><field name="signature" widget="signature"/></h2>
</xpath>
</field>
</record>
</data>
</openerp>

13
web_digital_sign/views/we_digital_sign_view.xml

@ -1,13 +0,0 @@
<openerp>
<data>
<template id="web_digital_sign_backend" name="web_digital_sign assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript"
src="/web_digital_sign/static/lib/jSignature/jSignatureCustom.js"></script>
<script type="text/javascript"
src="/web_digital_sign/static/src/js/digital_sign.js"></script>
</xpath>
</template>
</data>
</openerp>

70
web_widget_digitized_signature/README.rst

@ -0,0 +1,70 @@
.. 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
=======================
Web Digitized Signature
=======================
This module provides a widget for binary fields that allows to digitize a
signature and store it as an image.
As demonstration, it includes this widget at user level, so that we can store
a signature image for each user.
Configuration
=============
#. To use this module, you need to add ``widget="signature"`` to your binary
field in your view.
#. You can specifify signature dimensions like the following:
``<field name="signature_image" widget="signature" width="400" height="100"/>``
Usage
=====
#. Go to *Settings > Users > Users*.
#. Open one of the existing users.
#. You can set a digital signature for it on the field "Signature".
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/162/9.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/web/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.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Jay Vora <jay.vora@serpentcs.com>
* 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.

6
web_widget_digitized_signature/__init__.py

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2004-2010 OpenERP SA (<http://www.openerp.com>)
# Copyright 2011-2015 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

29
web_widget_digitized_signature/__openerp__.py

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Copyright 2004-2010 OpenERP SA (<http://www.openerp.com>)
# Copyright 2011-2015 Serpent Consulting Services Pvt. Ltd.
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Web Widget Digitized Signature",
"version": "9.0.1.0.0",
"author": "Serpent Consulting Services Pvt. Ltd., "
"Agile Business Group, "
"Tecnativa, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": 'Web',
'depends': [
'web',
'mail',
],
'data': [
'views/web_digital_sign_view.xml',
'views/res_users_view.xml',
],
'website': 'http://www.serpentcs.com',
'qweb': [
'static/src/xml/digital_sign.xml',
],
'installable': True,
}

79
web_widget_digitized_signature/i18n/es.po

@ -0,0 +1,79 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_digitized_signature
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-11 04:42+0000\n"
"PO-Revision-Date: 2017-07-11 04:42+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: web_widget_digitized_signature
#. openerp-web
#: code:addons/web_widget_digitized_signature/static/src/xml/digital_sign.xml:7
#, python-format
msgid "Clear"
msgstr "Limpiar"
#. module: web_widget_digitized_signature
#. openerp-web
#: code:addons/web_widget_digitized_signature/static/src/js/digital_sign.js:81
#, python-format
msgid "Could not display the selected image."
msgstr "No se puede mostrar la imagen seleccionada."
#. module: web_widget_digitized_signature
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:26
#, python-format
msgid "Deletion date: %s"
msgstr "Fecha de eliminación: %s"
#. module: web_widget_digitized_signature
#. openerp-web
#: code:addons/web_widget_digitized_signature/static/src/xml/digital_sign.xml:10
#, python-format
msgid "Draw your signature"
msgstr "Dibuje su firma"
#. module: web_widget_digitized_signature
#. openerp-web
#: code:addons/web_widget_digitized_signature/static/src/js/digital_sign.js:81
#, python-format
msgid "Image"
msgstr "Imagen"
#. module: web_widget_digitized_signature
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_res_users_signature_image
msgid "Signature"
msgstr "Firma"
#. module: web_widget_digitized_signature
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:23
#, python-format
msgid "Signature date: %s"
msgstr "Fecha de la firma: %s"
#. module: web_widget_digitized_signature
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:21
#, python-format
msgid "Signature has been created."
msgstr "La firma se ha creado."
#. module: web_widget_digitized_signature
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:25
#, python-format
msgid "Signature has been deleted."
msgstr "La firma se ha eliminado."
#. module: web_widget_digitized_signature
#: model:ir.model,name:web_widget_digitized_signature.model_res_users
msgid "Users"
msgstr "Usuarios"

7
web_widget_digitized_signature/models/__init__.py

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2004-2010 OpenERP SA (<http://www.openerp.com>)
# Copyright 2011-2015 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import mail_thread
from . import res_users

40
web_widget_digitized_signature/models/mail_thread.py

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# Copyright 2004-2010 OpenERP SA (<http://www.openerp.com>)
# Copyright 2011-2015 Serpent Consulting Services Pvt. Ltd.
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import base64
from openerp import _, models, fields
class MailThread(models.Model):
_inherit = "mail.thread"
def _track_signature(self, values, field):
""" This method allows to track creation and deletion of signature
field. You must call this method in order to display a message
in the chatter with information of the changes in the signature.
:param values: a dict with the values being written
:param field: name of the field that must be tracked
"""
if field in values:
attachments = []
messages = []
if values.get(field):
content = base64.b64decode(values.get(field))
attachments = [('signature', content)]
messages.append(_('Signature has been created.'))
messages.append(
_('Signature date: %s' % fields.Datetime.now()))
else:
messages.append(_('Signature has been deleted.'))
messages.append(_('Deletion date: %s' % fields.Datetime.now()))
msg_body = '<ul>'
for message in messages:
msg_body += '<li>'
msg_body += message
msg_body += '</li>'
msg_body += '</ul>'
self.message_post(body=msg_body, attachments=attachments)

16
web_widget_digitized_signature/models/res_users.py

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2004-2010 OpenERP SA (<http://www.openerp.com>)
# Copyright 2011-2015 Serpent Consulting Services Pvt. Ltd.
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
class Users(models.Model):
_name = 'res.users'
_inherit = 'res.users'
signature_image = fields.Binary(
string='Signature',
)

BIN
web_widget_digitized_signature/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 8.9 KiB

0
web_digital_sign/static/lib/jSignature/jSignatureCustom.js → web_widget_digitized_signature/static/lib/jSignature/jSignatureCustom.js

2
web_digital_sign/static/src/js/digital_sign.js → web_widget_digitized_signature/static/src/js/digital_sign.js

@ -1,4 +1,4 @@
odoo.define('web_digital_sign.web_digital_sign', function(require) {
odoo.define('web_widget_digitized_signature.web_digital_sign', function(require) {
"use strict";
var core = require('web.core');

4
web_digital_sign/static/src/xml/digital_sign.xml → web_widget_digitized_signature/static/src/xml/digital_sign.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
<template id="template" xml:space="preserve">
<t t-name="FieldSignature">
<div class="panel panel-default mt16 mb0 " id="drawsign">
<div class="panel-heading oe_edit_only">
@ -21,4 +21,4 @@
t-att-tabindex="widget.node.attrs.img_tabindex || widget.node.attrs.tabindex"
/>
</t>
</templates>
</template>

27
web_widget_digitized_signature/views/res_users_view.xml

@ -0,0 +1,27 @@
<?xml version="1.0" ?>
<odoo>
<record id="inherited_res_users_form" model="ir.ui.view">
<field name="name">inherited.res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='signature']" position="after">
<label for="signature_image" class="oe_edit_only"/>
<h2><field name="signature_image" widget="signature"/></h2>
</xpath>
</field>
</record>
<record id="view_users_form_simple_modif" model="ir.ui.view">
<field name="name">res.users.preferences.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='signature']" position="after">
<label for="signature_image" class="oe_edit_only"/>
<h2><field name="signature_image" widget="signature"/></h2>
</xpath>
</field>
</record>
</odoo>

11
web_widget_digitized_signature/views/web_digital_sign_view.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="web_widget_digitized_signature_backend" name="web_widget_digitized_signature assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_widget_digitized_signature/static/lib/jSignature/jSignatureCustom.js"></script>
<script type="text/javascript" src="/web_widget_digitized_signature/static/src/js/digital_sign.js"></script>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save