add signature to delivery_sheet

develop
Andreas Osim 2021-06-10 16:40:23 +02:00
parent 0135d7cd6f
commit 70286bf5e6
27 changed files with 1982 additions and 0 deletions

View File

@ -0,0 +1,17 @@
OpenERP, Open Source Management Solution
Copyright (C) 2011-TODAY 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/>.

View File

@ -0,0 +1,37 @@
=================
Web Digital Sign
=================
* 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.
Usage
=====
* To use this module, you need to add widget="signature" to your binary field in your view.
* User can store their digital signature in the binary field, as you can see image.
* As shown in the image, user can add a signature using mouse, pen, or finger.
* User can clear signature using clear button and it will re-initialize the signature.
Bug Tracker
===========
Credits
=======
Contributors
------------
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>

View File

@ -0,0 +1,3 @@
# See LICENSE file for full copyright and licensing details.
from . import models

View File

@ -0,0 +1,29 @@
# See LICENSE file for full copyright and licensing details.
{
'name': 'Web Digital Signature v11.0',
'version': '11.0.1.0.0',
'author': 'Serpent Consulting Services Pvt. Ltd.',
'maintainer': 'Serpent Consulting Services Pvt. Ltd.',
'complexity': 'easy',
'depends': ['web'],
"license": "AGPL-3",
'category': 'Tools',
'description': '''
This module provides the functionality to store digital signature
Example can be seen into the User's form view where we have
added a test field under signature.
''',
'summary': '''
Touch screen enable so user can add signature with touch devices.
Digital signature can be very usefull for documents.
''',
'images': ['static/description/Digital_Signature.jpg'],
'data': [
'views/web_digital_sign_view.xml',
'views/users_view.xml'],
'website': 'http://www.serpentcs.com',
'qweb': ['static/src/xml/digital_sign.xml'],
'installable': True,
'auto_install': False,
}

View File

@ -0,0 +1,3 @@
# See LICENSE file for full copyright and licensing details.
from . import users

View File

@ -0,0 +1,9 @@
# See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class Users(models.Model):
_inherit = 'res.users'
digital_signature = fields.Binary(string='Signature')

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,259 @@
<section class="oe_container">
<div class="oe_row">
<div class="text-justify" style="background:#dcdcdc;padding-top:2px;padding-bottom:2px">
<h2 class="oe_slogan" style="color:#875A7B;font-family:times new roman;margin-top:20px;margin-bottom:20px;">
<span class="label" style="background:#875A7B;">
Web Digital Signature
</span>
</h2>
<hr width="60%" style="border-style:solid;border-top-width:2px;" />
<h3 class="oe_slogan" style="font-family:times new roman;">This module provides the functionality to store digital signature for a record</h3>
<table class="text-justify" style="margin-left: 10px;margin-right: 10px;margin-bottom: 10px;">
<tbody>
<tr>
<td>
<span class="fa fa-hand-o-right fa-2x" style="padding-bottom:25px;padding-right:10px;color:#875A7B;"/>
</td>
<td class="oe_mt8" style="font-size: 18px;font-family:times new roman;">
This module is helpful to make your business process a little bit more faster & makes it more user friendly by providing you digital signature functionality on your documents.
</td>
</tr>
<tr>
<td>
<span class="fa fa-hand-o-right fa-2x" style="color:#875A7B;"/>
</td>
<td class="oe_mt8" style="font-size: 18px;font-family:times new roman;">
It is touch screen enable so user can add signature with touch devices.
</td>
</tr>
<tr>
<td>
<span class="fa fa-hand-o-right fa-2x" style="padding-bottom:25px;;color:#875A7B;"/>
</td>
<td class="oe_mt8" style="font-size: 18px;font-family:times new roman;">
Digital signature can be very useful for documents such as sale orders, purchase orders, invoices, payslips, procurement receipts, etc.
</td>
</tr>
</tbody>
</table>
</div>
<div>
<hr width="100%" style="border-style:solid;border-top-width:2px;" />
<h2 class="oe_slogan" style="margin-top:20px;margin-bottom:20px;color:#875A7B;font-family:times new roman;">
<span class="label" style="background:#875A7B">
Usage
</span>
</h2>
<h3 class="oe_slogan" style="margin-top:10px;margin-bottom:10px;font-family:times new roman;">To use this module, you need to add widget="signature" to your binary field in your view.</h3>
</div>
</div>
</section>
<hr width="100%" style="border-style:solid;border-top-width:2px;" />
<section class="oe_container">
<div class="oe_row" style="padding-top:2px;padding-bottom:2px;background:#dcdcdc">
<div>
<h2 class="oe_slogan" style="margin-top:20px;margin-bottom:20px;color:#875A7B;font-family:times new roman;">
<span class="label" style="background:#875A7B">
Signature Views
</span>
</h2>
<hr width="60%" style="border-style:solid;border-top-width:2px;" />
<h4 class="oe_slogan" style="font-size:24px;font-family:times new roman;">
<span class="label" style="background:#875A7B">
<span class="fa fa-star fa-spin"/>
Digital Signature View
</span>
</h4>
<p class='oe_mt32' style="text-align:center;font-size: 18px;font-family:times new roman;">User can store their digital signature
in the binary field, as you can see image.</p>
</div>
<div>
<img class="oe_demo oe_picture oe_screenshot" src="img/sign1.png">
</div>
<div>
<h4 class="oe_slogan" style="font-size:24px;font-family:times new roman;">
<span class="label" style="background:#875A7B">
<span class="fa fa-star fa-spin"/>
Draw Signature
</span>
</h4>
<p class='oe_mt32' style="text-align:center;font-size: 18px;font-family:times new roman;">As shown in the image, user can add a signature using mouse, pen, or finger.</p>
</div>
<div>
<img class="oe_demo oe_picture oe_screenshot" src="img/sign2.png">
</div>
<div>
<h4 class="oe_slogan" style="font-size:24px;font-family:times new roman;">
<span class="label" style="background:#875A7B">
<span class="fa fa-star fa-spin"/>
Clear Digital Signature
</span>
</h4>
<p class='oe_mt32' style="text-align:center;font-size: 18px;font-family:times new roman;">User can clear signature using clear button and it will re-initialize the signature.</p>
</div>
<div>
<img class="oe_demo oe_picture oe_screenshot" src="img/sign3.png">
</div>
</div>
</section>
<!-- LEFT::LEFT PHOTO - MEDIUM -->
<table style="font-family: 'Helvetica Neue', Helvetica, Arial,
sans-serif;" cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td colspan="2" style="font-size:16px; color:#d74930; font-weight:bold;" width="100%" align="center">
<span class="fa fa-certificate fa-1x" style="color:#1f2327;">Check out our various Odoo Services below</span>
</td>
</tr>
<tr>
<td colspan="2" style="border-bottom:#d74930 solid 1px; line-height:10px;">&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<table style="font-size:11px; color:#697582; line-height:20px;" cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/odoo-openerp-services/consulting" style="color:#697582; text-decoration:none;">Odoo Consulting</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/odoo-openerp-services/gap-analysis" style="color:#697582; text-decoration:none;">Gap Analysis and BPR</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/odoo-openerp-services/implementation" style="color:#697582; text-decoration:none;">Odoo Implementation</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/ecommerce-integrations/magento-integration" style="color:#697582; text-decoration:none;">Integration with E-Commerce</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/trainings/openerp-odoo-technical-training" style="color:#697582; text-decoration:none;">Odoo Technical Training</a></span></td>
</tr>
<tr>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/odoo-openerp-services/offshore-development-partnership" style="color:#697582; text-decoration:none;">Offshore & Onsite Development</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/odoo-packages/odoo-support-package" style="color:#697582; text-decoration:none;">Support and Maintenance</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/odoo-openerp-services/hire-odoo-openerp-developer" style="color:#697582; text-decoration:none;">Hire Dedicated Odoo Developer</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/ecommerce-integrations/paymentech-elavon-paypal-integration" style="color:#697582; text-decoration:none;">Payment Gateway Integrations</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/trainings/openerpodoo-functional-training" style="color:#697582; text-decoration:none;">Odoo Functional Training</a></span></td>
</tr>
<tr>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/community/aios-mobile-client" style="color:#697582; text-decoration:none;">Odoo Mobile App Development</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.odooqa.com/page/manual-functional-testing" style="color:#697582; text-decoration:none;">Odoo Manual Testing</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.odooqa.com/page/automated-functional-testing" style="color:#697582; text-decoration:none;">Odoo Automated Testing</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/ecommerce-integrations/fedex-ups-usps-integration" style="color:#697582; text-decoration:none;">Integration with Shipping API</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com/services/odoo-openerp-services/installation-and-hosting" style="color:#697582; text-decoration:none;">Installation & Hosting</a></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="border-bottom:#d74930 solid 1px; line-height:10px;">&nbsp;
</td>
</tr>
<tr>
<td colspan="2" style="font-size:16px; color:#d74930; font-weight:bold;" width="100%" align="center">
<span class="fa fa-certificate fa-1x" style="color:#1f2327;">Check out our various Odoo Based Products</span >
</td>
</tr>
<tr>
<td colspan="2" style="border-bottom:#d74930 solid 1px; line-height:10px;">&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<table style="font-size:11px; color:#697582; line-height:20px;" cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="20%"><span class="fa fa-coffee fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/restaurant-management-system" style="color:#697582; text-decoration:none;">Restaurant Management</a></span></td>
<td width="20%"><span class="fa fa-building fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/property-management-system" style="color:#697582; text-decoration:none;">Property Management</a></span></td>
<td width="20%"><span class="fa fa-plane fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/visa-management-system" style="color:#697582; text-decoration:none;">Visa Agency Management</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/odoo-singapore-localization" style="color:#697582; text-decoration:none;">Singapore Localization</a></span></td>
<td width="20%"><span class="fa fa-graduation-cap fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/education-management-system" style="color:#697582; text-decoration:none;">School, University Management</a></span></td>
</tr>
<tr>
<td width="20%"><span class="fa fa-cubes fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/construction-management-system" style="color:#697582; text-decoration:none;">Construction Management</a></span></td>
<td width="20%"><span class="fa fa-bus fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/fleet-management-systems" style="color:#697582; text-decoration:none;">Fleet Management</a></span></td>
<td width="20%"><span class="fa fa-stethoscope fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/healthcare-management-software" style="color:#697582; text-decoration:none;">Medical ERP</a></span></td>
<td width="20%"><span class="fa fa-hotel fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/hotel-management-system" style="color:#697582; text-decoration:none;">Hotel Management</a></span></td>
<td width="20%"><span class="fa fa-users fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/human-resource-management-system" style="color:#697582; text-decoration:none;">Human Resource Management</a></span></td>
</tr>
<tr>
<td width="20%"><span class="fa fa-map-marker fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/odoo-fieldstaff-tracking-system" style="color:#697582; text-decoration:none;">Field Service Management</a></span></td>
<td width="20%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/spa-salon-management-system" style="color:#697582; text-decoration:none;">Spa & Salone Management</a></span></td>
<td width="20%"><span class="fa fa-phone fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/odoo-ringcentral-integration" style="color:#697582; text-decoration:none;">Ringcentral telephone integration</a></span></td>
<td width="20%"><span class="fa fa-heart fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/customer-relationship-management" style="color:#697582; text-decoration:none;">Customer Relationship</a></span></td>
<td width="20%"><span class="fa fa-user fa-1x" style="color:#697582;"> <a href="http://serpentcs.in/product/talent-management-system" style="color:#697582; text-decoration:none;">Talent Management</a></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="border-bottom:#d74930 solid 1px; line-height:10px;">&nbsp;
</td>
</tr>
<tr>
<td colspan="2" style="font-size:16px; color:#d74930; font-weight:bold;" width="100%" align="center">
<span class="fa fa-certificate fa-1x" style="color:#1f2327;">For any questions, support and development contact us.</span>
</td>
</tr>
<tr>
<td colspan="2" style="border-bottom:#d74930 solid 1px; line-height:10px;">&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<table style="font-size:11px; color:#697582; line-height:20px;" cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="38%"><span class="fa fa-whatsapp fa-1x" style="color:#697582;"> (+91) 98793-54457, (+91) 90334-72982 </span>
<span class="fa fa-phone fa-1x" style="color:#697582;"> +91-79-2975-0867</span></td>
<td width="17%"><span class="fa fa-envelope fa-1x" style="color:#697582;"> <a href="mailto:contact@serpentcs.com" style="color:#697582; text-decoration:none;">contact@serpentcs.com</a></span></td>
<td width="15%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.com" style="color:#697582; text-decoration:none;">www.serpentcs.com</a></span></td>
<td width="15%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.serpentcs.in" style="color:#697582; text-decoration:none;">www.serpentcs.in</a></span></td>
<td width="15%"><span class="fa fa-globe fa-1x" style="color:#697582;"> <a href="http://www.odooqa.com" style="color:#697582; text-decoration:none;">www.odooqa.com</a></span></td>
</tr>
<tr>
<td width="38%"><span class="fa fa-hand-pointer-o fa-1x" style="color:#697582;"> WhatsApp, Telegram or Call 24X7</span></td>
<td width="17%"><span class="fa fa-hand-pointer-o fa-1x" style="color:#697582;"> Help! Send Mail</span></td>
<td width="15%"><span class="fa fa-hand-pointer-o fa-1x" style="color:#697582;"> Browse our Services</span></td>
<td width="15%"><span class="fa fa-hand-pointer-o fa-1x" style="color:#697582;"> Browse our Products</span></td>
<td width="15%"><span class="fa fa-hand-pointer-o fa-1x" style="color:#697582;"> QA Services</span></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr colspan="2">
<td colspan="2" style="border-bottom:#d74930 solid 1px; line-height:10px;">&nbsp;
</td>
</tr>
<tr colspan="2">
<td colspan="2" style="padding-top:9px;">
<a href="https://www.facebook.com/Serpent-Consulting-Services-Pvt-Ltd-299017730141795/" style="text-decoration:none;"><img src="fb.jpg" style="vertical-align:middle; border-radius: 50%;" width="25">
</a>
<a href="https://twitter.com/Serpent_CS" style="text-decoration:none;"><img src="twitter.jpg" style="vertical-align:middle; border-radius: 50%;" width="25">
</a>
<a href="https://www.linkedin.com/company-beta/2435682/" style="text-decoration:none;"><img src="in.jpg" style="vertical-align:middle; border-radius: 50%;" width="25">
</a>
<a href="https://www.youtube.com/user/husendaudi123/videos" style="text-decoration:none;"><img src="youtube.jpg" style="vertical-align:middle; border-radius: 50%;" width="25">
</a>
<a href="https://www.instagram.com/explore/tags/serpentcs/"style="text-decoration:none;"><img src="insta.jpg" style="vertical-align:middle; border-radius: 50%;" width="25">
</a>
<a href="http://www.serpentcs.com"style="text-decoration:none;"><img src="serpent32.png" style="vertical-align:middle; border-radius: 50%;" width="25">
</a>
<a href="http://www.serpentcs.in"style="text-decoration:none;"><img src="serpent32.png" style="vertical-align:middle; border-radius: 50%;" width="25">
</a>
<a href="http://www.odooqa.com"style="text-decoration:none;"><img src="odooqa32.png" style="vertical-align:middle; border-radius: 50%;" width="25">
</a>
</td>
</tr>
<tr colspan="2">
<td colspan="2" style="font-size:8px; color:#697582; line-height:15px;padding-top:10px; text-align:justify;">
</td>
</tr>
</tbody>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,156 @@
odoo.define('web_digital_sign.web_digital_sign', function(require) {
"use strict";
var core = require('web.core');
var BasicFields= require('web.basic_fields');
var FormController = require('web.FormController');
var Registry = require('web.field_registry');
var utils = require('web.utils');
var session = require('web.session');
var field_utils = require('web.field_utils');
var _t = core._t;
var QWeb = core.qweb;
var FieldSignature = BasicFields.FieldBinaryImage.extend({
template: 'FieldSignature',
events: _.extend({}, BasicFields.FieldBinaryImage.prototype.events, {
'click .save_sign': '_on_save_sign',
'click #sign_clean': '_on_clear_sign'
}),
jsLibs: ['/web_digital_sign/static/lib/jSignature/jSignatureCustom.js'],
placeholder: "/web/static/src/img/placeholder.png",
init: function() {
this._super.apply(this, arguments);
this.$('> img').remove();
this.$('.signature > canvas').remove();
this.sign_options = {
'decor-color': '#D1D0CE',
'color': '#000',
'background-color': '#fff',
'height': '150',
'width': '550'
};
this.empty_sign = [];
},
start: function() {
var self = this;
this.$(".signature").jSignature("init", this.sign_options);
this.$(".signature").attr({
"tabindex": "0",
'height': "100"
});
this.empty_sign = this.$(".signature").jSignature("getData", 'image');
self._render();
},
_on_clear_sign: function() {
this.$(".signature > canvas").remove();
this.$('> img').remove();
this.$(".signature").attr("tabindex", "0");
var sign_options = {
'decor-color': '#D1D0CE',
'color': '#000',
'background-color': '#fff',
'height': '150',
'width': '550',
'clear': true
};
this.$(".signature").jSignature(sign_options);
this.$(".signature").focus();
this._setValue(false);
},
_on_save_sign: function(value_) {
var self = this;
this.$('> img').remove();
var signature = this.$(".signature").jSignature("getData", 'image');
var is_empty = signature ?
self.empty_sign[1] === signature[1] :
false;
if (!is_empty && typeof signature !== "undefined" && signature[1]) {
this._setValue(signature[1]);
}
},
_render: function() {
var self = this;
var url = this.placeholder;
if (this.value && !utils.is_bin_size(this.value)) {
url = 'data:image/png;base64,' + this.value;
} else if (this.value) {
url = session.url('/web/image', {
model: this.model,
id: JSON.stringify(this.res_id),
field: this.nodeOptions.preview_image || this.name,
unique: field_utils.format.datetime(this.recordData.__last_update).replace(/[^0-9]/g, ''),
});
} else {
url = this.placeholder;
}
if (this.mode === "readonly") {
var $img = $(QWeb.render("FieldBinaryImage-img", {
widget: self,
url: url
}));
this.$('> img').remove();
this.$(".signature").hide();
this.$el.prepend($img);
$img.on('error', function() {
self.on_clear();
$img.attr('src', self.placeholder);
self.do_warn(_t("Image"), _t("Could not display the selected image."));
});
} else if (this.mode === "edit") {
this.$('> img').remove();
if (this.value) {
var field_name = this.nodeOptions.preview_image ?
this.nodeOptions.preview_image :
this.name;
self._rpc({
model: this.model,
method: 'read',
args: [this.res_id, [field_name]]
}).done(function(data) {
if (data) {
var field_desc = _.values(_.pick(data[0], field_name));
self.$(".signature").jSignature("clear");
self.$(".signature").jSignature("setData", 'data:image/png;base64,' + field_desc[0]);
}
});
} else {
this.$('> img').remove();
this.$('.signature > canvas').remove();
var sign_options = {
'decor-color': '#D1D0CE',
'color': '#000',
'background-color': '#fff',
'height': '150',
'width': '550'
};
this.$(".signature").jSignature("init", sign_options);
}
} else if (this.mode === 'create') {
this.$('> img').remove();
this.$('> canvas').remove();
if (!this.value) {
this.$(".signature").empty().jSignature("init", {
'decor-color': '#D1D0CE',
'color': '#000',
'background-color': '#fff',
'height': '150',
'width': '550'
});
}
}
}
});
FormController.include({
saveRecord: function() {
this.$('.save_sign').click();
return this._super.apply(this, arguments);
}
});
Registry.add('signature', FieldSignature);
});

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
<t t-name="FieldSignature">
<t t-if="widget.mode != 'readonly'">
<div class="panel panel-default mt16 mb0 oe_edit_only" id="drawsign">
<div class="panel-heading">
<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"></div>
</div>
</t>
<t t-if="widget.mode == 'readonly'">
<div class="panel panel-default mt16 mb0 " id="drawsign">
<div class="signature"></div>
</div>
</t>
</t>
</templates>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<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="digital_signature" string="Signature" class="oe_edit_only" />
<h2>
<field name="digital_signature" widget="signature"/>
</h2>
</xpath>
</field>
</record>
<record id="inherited_res_users_preferences_form" model="ir.ui.view">
<field name="name">inherited.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="digital_signature" string="Signature" class="oe_edit_only"/>
<h2>
<field name="digital_signature" widget="signature"/>
</h2>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<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/src/js/digital_sign.js"></script>
</xpath>
</template>
</odoo>