Browse Source
Merge pull request #725 from eLBati/10.0-mig-web_widget_digitized_signature
Merge pull request #725 from eLBati/10.0-mig-web_widget_digitized_signature
[10.0] porting web_widget_digitized_signaturepull/730/head
Pedro M. Baeza
7 years ago
committed by
GitHub
18 changed files with 2222 additions and 0 deletions
-
70web_widget_digitized_signature/README.rst
-
6web_widget_digitized_signature/__init__.py
-
29web_widget_digitized_signature/__manifest__.py
-
106web_widget_digitized_signature/i18n/ca.po
-
106web_widget_digitized_signature/i18n/es.po
-
107web_widget_digitized_signature/i18n/fr.po
-
106web_widget_digitized_signature/i18n/sl.po
-
7web_widget_digitized_signature/models/__init__.py
-
40web_widget_digitized_signature/models/mail_thread.py
-
27web_widget_digitized_signature/models/res_users.py
-
BINweb_widget_digitized_signature/static/description/icon.png
-
1392web_widget_digitized_signature/static/lib/jSignature/jSignatureCustom.js
-
122web_widget_digitized_signature/static/src/js/digital_sign.js
-
24web_widget_digitized_signature/static/src/xml/digital_sign.xml
-
4web_widget_digitized_signature/tests/__init__.py
-
38web_widget_digitized_signature/tests/test_signature_tracking.py
-
27web_widget_digitized_signature/views/res_users_view.xml
-
11web_widget_digitized_signature/views/web_digital_sign_view.xml
@ -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/10.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. |
@ -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 |
@ -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": "10.0.0.1.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, |
|||
} |
@ -0,0 +1,106 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * web_widget_digitized_signature |
|||
# |
|||
# Translators: |
|||
# Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017 |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 9.0c\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2017-07-30 02:50+0000\n" |
|||
"PO-Revision-Date: 2017-07-30 02:50+0000\n" |
|||
"Last-Translator: Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017\n" |
|||
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Language: ca\n" |
|||
"Plural-Forms: nplurals=2; plural=(n != 1);\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 "" |
|||
|
|||
#. 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 "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_create_uid |
|||
msgid "Created by" |
|||
msgstr "Creat per" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_create_date |
|||
msgid "Created on" |
|||
msgstr "Creat a " |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:33 |
|||
#, python-format |
|||
msgid "Deletion date: %s" |
|||
msgstr "" |
|||
|
|||
#. 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 "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model,name:web_widget_digitized_signature.model_mail_thread |
|||
msgid "Email Thread" |
|||
msgstr "" |
|||
|
|||
#. 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 "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_write_uid |
|||
msgid "Last Updated by" |
|||
msgstr "Última actualització per" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_write_date |
|||
msgid "Last Updated on" |
|||
msgstr "Última actualització a " |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_res_users_signature_image |
|||
msgid "Signature" |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:30 |
|||
#, python-format |
|||
msgid "Signature date: %s" |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:28 |
|||
#, python-format |
|||
msgid "Signature has been created." |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:32 |
|||
#, python-format |
|||
msgid "Signature has been deleted." |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model,name:web_widget_digitized_signature.model_res_users |
|||
msgid "Users" |
|||
msgstr "Usuaris" |
@ -0,0 +1,106 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * web_widget_digitized_signature |
|||
# |
|||
# Translators: |
|||
# OCA Transbot <transbot@odoo-community.org>, 2017 |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 9.0c\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2017-07-30 02:50+0000\n" |
|||
"PO-Revision-Date: 2017-07-30 02:50+0000\n" |
|||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n" |
|||
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Language: es\n" |
|||
"Plural-Forms: nplurals=2; plural=(n != 1);\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 |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_create_uid |
|||
msgid "Created by" |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_create_date |
|||
msgid "Created on" |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:33 |
|||
#, 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 |
|||
#: model:ir.model,name:web_widget_digitized_signature.model_mail_thread |
|||
msgid "Email Thread" |
|||
msgstr "" |
|||
|
|||
#. 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_mail_thread_write_uid |
|||
msgid "Last Updated by" |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_write_date |
|||
msgid "Last Updated on" |
|||
msgstr "" |
|||
|
|||
#. 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:30 |
|||
#, 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:28 |
|||
#, 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:32 |
|||
#, 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" |
@ -0,0 +1,107 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * web_widget_digitized_signature |
|||
# |
|||
# Translators: |
|||
# OCA Transbot <transbot@odoo-community.org>, 2017 |
|||
# Quentin THEURET <odoo@kerpeo.com>, 2017 |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 9.0c\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2017-07-30 02:50+0000\n" |
|||
"PO-Revision-Date: 2017-07-30 02:50+0000\n" |
|||
"Last-Translator: Quentin THEURET <odoo@kerpeo.com>, 2017\n" |
|||
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Language: fr\n" |
|||
"Plural-Forms: nplurals=2; plural=(n > 1);\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 "Effacer" |
|||
|
|||
#. 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 "Impossible d'afficher l'image sélectionnée." |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_create_uid |
|||
msgid "Created by" |
|||
msgstr "Créé par" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_create_date |
|||
msgid "Created on" |
|||
msgstr "Créé le" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:33 |
|||
#, python-format |
|||
msgid "Deletion date: %s" |
|||
msgstr "Date de suppression : %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 "Dessinez votre signature" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model,name:web_widget_digitized_signature.model_mail_thread |
|||
msgid "Email Thread" |
|||
msgstr "Fil du courriel" |
|||
|
|||
#. 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 "Image" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_write_uid |
|||
msgid "Last Updated by" |
|||
msgstr "Mis à jour par" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_write_date |
|||
msgid "Last Updated on" |
|||
msgstr "Mis à jour le" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_res_users_signature_image |
|||
msgid "Signature" |
|||
msgstr "Signature" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:30 |
|||
#, python-format |
|||
msgid "Signature date: %s" |
|||
msgstr "Date de la signature : %s" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:28 |
|||
#, python-format |
|||
msgid "Signature has been created." |
|||
msgstr "La signature a été créée." |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:32 |
|||
#, python-format |
|||
msgid "Signature has been deleted." |
|||
msgstr "La signature a été supprimée." |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model,name:web_widget_digitized_signature.model_res_users |
|||
msgid "Users" |
|||
msgstr "Utilisateurs" |
@ -0,0 +1,106 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * web_widget_digitized_signature |
|||
# |
|||
# Translators: |
|||
# OCA Transbot <transbot@odoo-community.org>, 2017 |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 9.0c\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2017-07-30 02:50+0000\n" |
|||
"PO-Revision-Date: 2017-07-30 02:50+0000\n" |
|||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n" |
|||
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Language: sl\n" |
|||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\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 "" |
|||
|
|||
#. 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 "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_create_uid |
|||
msgid "Created by" |
|||
msgstr "Ustvaril" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_create_date |
|||
msgid "Created on" |
|||
msgstr "Ustvarjeno" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:33 |
|||
#, python-format |
|||
msgid "Deletion date: %s" |
|||
msgstr "" |
|||
|
|||
#. 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 "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model,name:web_widget_digitized_signature.model_mail_thread |
|||
msgid "Email Thread" |
|||
msgstr "" |
|||
|
|||
#. 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 "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_write_uid |
|||
msgid "Last Updated by" |
|||
msgstr "Zadnjič posodobil" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_mail_thread_write_date |
|||
msgid "Last Updated on" |
|||
msgstr "Zadnjič posodobljeno" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model.fields,field_description:web_widget_digitized_signature.field_res_users_signature_image |
|||
msgid "Signature" |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:30 |
|||
#, python-format |
|||
msgid "Signature date: %s" |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:28 |
|||
#, python-format |
|||
msgid "Signature has been created." |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: code:addons/web_widget_digitized_signature/models/mail_thread.py:32 |
|||
#, python-format |
|||
msgid "Signature has been deleted." |
|||
msgstr "" |
|||
|
|||
#. module: web_widget_digitized_signature |
|||
#: model:ir.model,name:web_widget_digitized_signature.model_res_users |
|||
msgid "Users" |
|||
msgstr "" |
@ -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 |
@ -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 odoo import _, models, fields |
|||
|
|||
|
|||
class MailThread(models.AbstractModel): |
|||
_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) |
@ -0,0 +1,27 @@ |
|||
# -*- 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 odoo import api, fields, models |
|||
|
|||
|
|||
class ResUsers(models.Model): |
|||
_name = 'res.users' |
|||
_inherit = ['res.users', 'mail.thread'] |
|||
|
|||
signature_image = fields.Binary( |
|||
string='Signature', |
|||
) |
|||
|
|||
@api.model |
|||
def create(self, vals): |
|||
res = super(ResUsers, self).create(vals) |
|||
res._track_signature(vals, 'signature_image') |
|||
return res |
|||
|
|||
@api.multi |
|||
def write(self, vals): |
|||
self._track_signature(vals, 'signature_image') |
|||
return super(ResUsers, self).write(vals) |
After Width: 128 | Height: 128 | Size: 8.9 KiB |
1392
web_widget_digitized_signature/static/lib/jSignature/jSignatureCustom.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,122 @@ |
|||
odoo.define('web_widget_digitized_signature.web_digital_sign', function(require) { |
|||
"use strict"; |
|||
|
|||
var core = require('web.core'); |
|||
var FormView = require('web.FormView'); |
|||
var utils = require('web.utils'); |
|||
var session = require('web.session'); |
|||
var Model = require('web.Model'); |
|||
|
|||
var _t = core._t; |
|||
var QWeb = core.qweb; |
|||
|
|||
var FieldSignature = core.form_widget_registry.map.image.extend({ |
|||
template: 'FieldSignature', |
|||
placeholder: "/web/static/src/img/placeholder.png", |
|||
initialize_content: function() { |
|||
var self = this; |
|||
this.$el.find('> img').remove(); |
|||
this.$el.find('.signature > canvas').remove(); |
|||
var sign_options = {'decor-color' : '#D1D0CE', 'color': '#000', 'background-color': '#fff','height':'150','width':'550'}; |
|||
this.$el.find(".signature").jSignature("init",sign_options); |
|||
this.$el.find(".signature").attr({"tabindex": "0",'height':"100"}); |
|||
this.empty_sign = this.$el.find(".signature").jSignature("getData",'image'); |
|||
this.$el.find('#sign_clean').click(this.on_clear_sign); |
|||
this.$el.find('.save_sign').click(this.on_save_sign); |
|||
}, |
|||
on_clear_sign: function() { |
|||
var self = this; |
|||
this.$el.find(".signature > canvas").remove(); |
|||
this.$el.find('> img').remove(); |
|||
this.$el.find(".signature").attr("tabindex", "0"); |
|||
var sign_options = {'decor-color' : '#D1D0CE', 'color': '#000', 'background-color': '#fff','height':'150','width':'550','clear': true}; |
|||
this.$el.find(".signature").jSignature(sign_options); |
|||
this.$el.find(".signature").focus(); |
|||
self.set('value', false); |
|||
}, |
|||
on_save_sign: function(value_) { |
|||
var self = this; |
|||
this.$el.find('> img').remove(); |
|||
var signature = self.$el.find(".signature").jSignature("getData",'image'); |
|||
var is_empty = signature |
|||
? self.empty_sign[1] === signature[1] |
|||
: false; |
|||
if (! is_empty && typeof signature !== "undefined" && signature[1]) { |
|||
self.set('value',signature[1]); |
|||
} |
|||
}, |
|||
render_value: function() { |
|||
var self = this; |
|||
var url = this.placeholder; |
|||
if (this.get('value') && !utils.is_bin_size(this.get('value'))) { |
|||
url = 'data:image/png;base64,' + this.get('value'); |
|||
} else if (this.get('value')) { |
|||
url = this.session.url('/web/binary/image', { |
|||
model: this.view.dataset.model, |
|||
id: JSON.stringify(this.view.datarecord.id || null), |
|||
field: this.options.preview_image |
|||
? this.options.preview_image |
|||
: this.name, |
|||
t: new Date().getTime() |
|||
}); |
|||
} else { |
|||
url = this.placeholder; |
|||
} |
|||
if (this.view.get("actual_mode") === 'view') { |
|||
var $img = $(QWeb.render("FieldBinaryImage-extend", { widget: this, url: url })); |
|||
this.$el.find('> img').remove(); |
|||
this.$el.find(".signature").hide(); |
|||
this.$el.prepend($img); |
|||
$img.load(function() { |
|||
if (! self.options.size) { |
|||
return; |
|||
} |
|||
$img.css("max-width", "" + self.options.size[0] + "px"); |
|||
$img.css("max-height", "" + self.options.size[1] + "px"); |
|||
$img.css("margin-left", "" + (self.options.size[0] - $img.width()) / 2 + "px"); |
|||
$img.css("margin-top", "" + (self.options.size[1] - $img.height()) / 2 + "px"); |
|||
}); |
|||
$img.on('error', function() { |
|||
$img.attr('src', self.placeholder); |
|||
self.do_warn(_t("Image"), _t("Could not display the selected image.")); |
|||
}); |
|||
} else if (this.view.get("actual_mode") === 'edit') { |
|||
this.$el.find('> img').remove(); |
|||
if (this.get('value')) { |
|||
var field_name = this.options.preview_image |
|||
? this.options.preview_image |
|||
: this.name; |
|||
new Model(this.view.dataset.model).call("read", [this.view.datarecord.id, [field_name]]).done(function(data) { |
|||
if (data) { |
|||
var field_desc = _.values(_.pick(data, field_name)); |
|||
self.$el.find(".signature").jSignature("reset"); |
|||
self.$el.find(".signature").jSignature("setData",'data:image/png;base64,'+field_desc[0]); |
|||
} |
|||
}); |
|||
} else { |
|||
this.$el.find('> img').remove(); |
|||
this.$el.find('.signature > canvas').remove(); |
|||
var sign_options = {'decor-color' : '#D1D0CE', 'color': '#000','background-color': '#fff','height':'150','width':'550'}; |
|||
this.$el.find(".signature").jSignature("init",sign_options); |
|||
} |
|||
} else if (this.view.get("actual_mode") === 'create') { |
|||
this.$el.find('> img').remove(); |
|||
this.$el.find('> canvas').remove(); |
|||
if (!this.get('value')) { |
|||
this.$el.find(".signature").empty().jSignature("init",{'decor-color' : '#D1D0CE', 'color': '#000','background-color': '#fff','height':'150','width':'550'}); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
|
|||
core.form_widget_registry.add('signature', FieldSignature); |
|||
|
|||
FormView.include({ |
|||
save: function() { |
|||
this.$el.find('.save_sign').click(); |
|||
return this._super.apply(this, arguments); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
@ -0,0 +1,24 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<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"> |
|||
<div class="pull-right"> |
|||
<a id="sign_clean" class="btn btn-xs oe_edit_only">Clear</a> |
|||
<a class="oe_edit_only save_sign"></a> |
|||
</div> |
|||
<strong>Draw your signature</strong> |
|||
</div> |
|||
<div class="signature panel-body"></div> |
|||
</div> |
|||
</t> |
|||
<t t-name="FieldBinaryImage-extend"> |
|||
<img t-att-src='url' |
|||
t-att-border="widget.readonly ? 0 : 1" |
|||
t-att-name="widget.name" |
|||
t-att-width="widget.node.attrs.img_width || widget.node.attrs.width" |
|||
t-att-height="widget.node.attrs.img_height || widget.node.attrs.height" |
|||
t-att-tabindex="widget.node.attrs.img_tabindex || widget.node.attrs.tabindex" |
|||
/> |
|||
</t> |
|||
</template> |
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import test_signature_tracking |
@ -0,0 +1,38 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2017 Tecnativa - Pedro M. Baeza |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from odoo.tests import common |
|||
|
|||
|
|||
class TestSignatureTracking(common.SavepointCase): |
|||
@classmethod |
|||
def setUpClass(cls): |
|||
super(TestSignatureTracking, cls).setUpClass() |
|||
cls.user = cls.env['res.users'].create({ |
|||
'name': 'Test User', |
|||
'login': 'Test User', |
|||
'email': 'test@example.com', |
|||
}) |
|||
cls.user.lang = 'en_US' |
|||
# Simple 1x1 transparent base64 encoded GIF |
|||
cls.image = 'R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' |
|||
cls.attachment_obj = cls.env['ir.attachment'] |
|||
cls.message_obj = cls.env['mail.message'] |
|||
|
|||
def test_signature_tracking(self): |
|||
"""We have to test in a tricky way, as res.users doesn't allow a |
|||
direct chatter""" |
|||
prev_attachment_num = self.attachment_obj.search_count([]) |
|||
prev_messages = self.message_obj.search([]) |
|||
self.user.signature_image = self.image |
|||
current_attachment_num = self.attachment_obj.search_count([]) |
|||
self.assertEqual(current_attachment_num - prev_attachment_num, 1) |
|||
current_messages = self.message_obj.search([]) |
|||
message = current_messages - prev_messages |
|||
self.assertIn('Signature has been created.', message.body) |
|||
prev_messages = current_messages |
|||
self.user.signature_image = False |
|||
current_messages = self.message_obj.search([]) |
|||
message = current_messages - prev_messages |
|||
self.assertIn('Signature has been deleted.', message.body) |
@ -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> |
@ -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> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue