3
0
Fork 0

Removed v8 modules.

Migrated digital sign and one2many kanban

Added Lib for digital sign module.

Fixed the issue of xpath ref #45.
9.0
MeetSCS 2015-12-01 14:35:11 +05:30 committed by Pedro M. Baeza
parent 4251af33f5
commit 03618d3502
6 changed files with 67 additions and 100 deletions

View File

@ -0,0 +1,17 @@
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/>.

View File

@ -1,24 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## # Part of Odoo. See LICENSE file for full copyright and licensing details.
#
# 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/>.
#
##############################################################################
import users import users
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,27 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## # Part of Odoo. See LICENSE file for full copyright and licensing details.
#
# 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/>.
#
##############################################################################
{ {
"name" : "Web Digital Signature", "name" : "Web Digital Signature 9.0",
"version" : "1.0", "version" : "1.0",
"author" : "Serpent Consulting Services Pvt. Ltd.", "author" : "Serpent Consulting Services Pvt. Ltd.",
"category": '', "category": '',

View File

@ -1,19 +1,25 @@
openerp.web_digital_sign = function(instance) { odoo.define('web_digital_sign.web_digital_sign',function(require){
var _t = instance.web._t; "use strict";
var QWeb = instance.web.qweb;
var images = {}
instance.web.form.widgets.add('signature', 'instance.web.form.FieldSignature'); var core = require('web.core');
instance.web.form.FieldSignature = instance.web.form.FieldBinaryImage.extend({ var data = require('web.data');
var FormView = require('web.FormView');
var utils = require('web.utils');
var _t = core._t;
var QWeb = core.qweb;
var images = {};
var FieldSignature = core.form_widget_registry.map.image.extend({
template: 'FieldSignature', template: 'FieldSignature',
render_value: function() { render_value: function() {
var self = this; var self = this;
var url; var url;
if (this.get('value') && !instance.web.form.is_bin_size(this.get('value'))) { if (this.get('value') && ! utils.is_bin_size(this.get('value'))) {
url = 'data:image/png;base64,' + this.get('value'); url = 'data:image/png;base64,' + this.get('value');
}else if (this.get('value')) { }else if (this.get('value')) {
var id = JSON.stringify(this.view.datarecord.id || null); var id = JSON.stringify(this.view.datarecord.id || null);
self.digita_dataset = new instance.web.DataSetSearch(self, self.view.model, {}, []); self.digita_dataset = new data.DataSetSearch(self, self.view.model, {}, []);
self.digita_dataset.read_slice(['id', self.name], {'domain': [['id', '=', id]]}).then(function(records){ self.digita_dataset.read_slice(['id', self.name], {'domain': [['id', '=', id]]}).then(function(records){
_.each(records,function(record){ _.each(records,function(record){
if(record[self.name]){ if(record[self.name]){
@ -67,7 +73,7 @@ openerp.web_digital_sign = function(instance) {
$(self.$el[0]).find(".signature").show(); $(self.$el[0]).find(".signature").show();
$(self.$el[0]).find(".signature").signature('clear'); $(self.$el[0]).find(".signature").signature('clear');
}); });
$('.save_sign').click(function(){ $(this.$el[0]).find('.save_sign').on('click',function(){
var val var val
if($(self.$el[0]).find(".signature").hasClass( "kbw-signature" ) && ! $(self.$el[0]).find(".signature").signature('isEmpty')){ if($(self.$el[0]).find(".signature").hasClass( "kbw-signature" ) && ! $(self.$el[0]).find(".signature").signature('isEmpty')){
$(self.$el[0]).find(".signature").hide(); $(self.$el[0]).find(".signature").hide();
@ -109,24 +115,29 @@ openerp.web_digital_sign = function(instance) {
$img.css("margin-top", "" + (self.options.size[1] - $img.height()) / 2 + "px"); $img.css("margin-top", "" + (self.options.size[1] - $img.height()) / 2 + "px");
}); });
$img.on('error', function() { $img.on('error', function() {
console.log("eroor")
$img.attr('src', self.placeholder); $img.attr('src', self.placeholder);
instance.webclient.notification.warn(_t("Image"), _t("Could not display the selected image.")); self.do_warn(_t("Image"), _t("Could not display the selected image."));
}); });
}, },
}); });
instance.web.FormView.include({
core.form_widget_registry.add('signature', FieldSignature)
FormView.include({
save: function(prepend_on_create) { save: function(prepend_on_create) {
var self = this; var self = this;
$('.save_sign').click() $('.save_sign').click()
var save_obj = {prepend_on_create: prepend_on_create, ret: null}; var save_obj = {prepend_on_create: prepend_on_create, ret: null};
this.save_list.push(save_obj); this.save_list.push(save_obj);
return this._process_operations().then(function() { return self._process_operations().then(function() {
if (save_obj.error) if (save_obj.error)
return $.Deferred().reject(); return $.Deferred().reject();
return $.when.apply($, save_obj.ret); return $.when.apply($, save_obj.ret);
}).done(function() { }).done(function(result) {
self.$el.removeClass('oe_form_dirty'); self.$el.removeClass('oe_form_dirty');
}); });
}, },
}) });
}
});

View File

@ -1,24 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## # Part of Odoo. See LICENSE file for full copyright and licensing details.
#
# 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/>.
#
##############################################################################
from openerp import models, fields, api from openerp import models, fields, api
@ -26,6 +7,6 @@ class Users(models.Model):
_name = 'res.users' _name = 'res.users'
_inherit = 'res.users' _inherit = 'res.users'
signature_image= fields.Binary(string='Signature') signature= fields.Binary(string='Signature')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

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