Browse Source

Removed v8 modules.

Migrated digital sign and one2many kanban

Added Lib for digital sign module.

Fixed the issue of xpath ref #45.
pull/666/head
MeetSCS 9 years ago
committed by Pedro M. Baeza
parent
commit
03618d3502
  1. 17
      web_digital_sign/LICENSE/LICENSE
  2. 22
      web_digital_sign/__init__.py
  3. 24
      web_digital_sign/__openerp__.py
  4. 65
      web_digital_sign/static/src/js/digital_sign.js
  5. 23
      web_digital_sign/users.py
  6. 16
      web_digital_sign/users_view.xml

17
web_digital_sign/LICENSE/LICENSE

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

22
web_digital_sign/__init__.py

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

24
web_digital_sign/__openerp__.py

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

65
web_digital_sign/static/src/js/digital_sign.js

@ -1,19 +1,25 @@
openerp.web_digital_sign = function(instance) {
var _t = instance.web._t;
var QWeb = instance.web.qweb;
var images = {}
odoo.define('web_digital_sign.web_digital_sign',function(require){
"use strict";
instance.web.form.widgets.add('signature', 'instance.web.form.FieldSignature');
instance.web.form.FieldSignature = instance.web.form.FieldBinaryImage.extend({
var core = require('web.core');
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',
render_value: function() {
var self = this;
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');
}else if (this.get('value')) {
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){
_.each(records,function(record){
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").signature('clear');
});
$('.save_sign').click(function(){
$(this.$el[0]).find('.save_sign').on('click',function(){
var val
if($(self.$el[0]).find(".signature").hasClass( "kbw-signature" ) && ! $(self.$el[0]).find(".signature").signature('isEmpty')){
$(self.$el[0]).find(".signature").hide();
@ -86,18 +92,18 @@ openerp.web_digital_sign = function(instance) {
t: (new Date().getTime()),
});
}else{
var id = JSON.stringify(self.view.datarecord.id || null);
var field = self.name;
if (self.options.preview_image)
field = self.options.preview_image;
url = self.session.url('/web/binary/image', {
model: self.view.dataset.model,
id: id,
field: field,
t: (new Date().getTime()),
});
var $img = $(QWeb.render("FieldBinaryImage-extend", { widget: self, url: url }));
self.$el.find('> img').remove();
var id = JSON.stringify(self.view.datarecord.id || null);
var field = self.name;
if (self.options.preview_image)
field = self.options.preview_image;
url = self.session.url('/web/binary/image', {
model: self.view.dataset.model,
id: id,
field: field,
t: (new Date().getTime()),
});
var $img = $(QWeb.render("FieldBinaryImage-extend", { widget: self, url: url }));
self.$el.find('> img').remove();
}
});
$img.load(function() {
@ -109,24 +115,29 @@ openerp.web_digital_sign = function(instance) {
$img.css("margin-top", "" + (self.options.size[1] - $img.height()) / 2 + "px");
});
$img.on('error', function() {
console.log("eroor")
$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) {
var self = this;
$('.save_sign').click()
var save_obj = {prepend_on_create: prepend_on_create, ret: null};
this.save_list.push(save_obj);
return this._process_operations().then(function() {
return self._process_operations().then(function() {
if (save_obj.error)
return $.Deferred().reject();
return $.when.apply($, save_obj.ret);
}).done(function() {
}).done(function(result) {
self.$el.removeClass('oe_form_dirty');
});
},
})
}
});
});

23
web_digital_sign/users.py

@ -1,24 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# 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/>.
#
##############################################################################
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields, api
@ -26,6 +7,6 @@ class Users(models.Model):
_name = '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:

16
web_digital_sign/users_view.xml

@ -1,18 +1,16 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="inherited_res_users_form" model="ir.ui.view">
<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="replace">
<label for="signature_image" class="oe_edit_only"/>
<h2><field name="signature_image" widget="signature"/></h2>
</xpath>
<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>
</data>
</openerp>
Loading…
Cancel
Save