From d0f5463a7ac3f0eef5dc3e6b259029b2b09177a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Au=C3=A9lien=20DUMAINE?= Date: Wed, 9 Jul 2014 14:20:20 +0200 Subject: [PATCH 01/48] Initial check-in of the module pos_customer_display. --- pos_customer_display/__init__.py | 1 + pos_customer_display/__openerp__.py | 46 +++ .../customer_display_view.xml | 16 ++ pos_customer_display/pos_customer_display.py | 46 +++ pos_customer_display/pos_customer_display.xml | 10 + .../static/src/js/customer_display.js | 264 ++++++++++++++++++ 6 files changed, 383 insertions(+) create mode 100755 pos_customer_display/__init__.py create mode 100755 pos_customer_display/__openerp__.py create mode 100644 pos_customer_display/customer_display_view.xml create mode 100644 pos_customer_display/pos_customer_display.py create mode 100755 pos_customer_display/pos_customer_display.xml create mode 100755 pos_customer_display/static/src/js/customer_display.js diff --git a/pos_customer_display/__init__.py b/pos_customer_display/__init__.py new file mode 100755 index 00000000..7dff50a7 --- /dev/null +++ b/pos_customer_display/__init__.py @@ -0,0 +1 @@ +import pos_customer_display diff --git a/pos_customer_display/__openerp__.py b/pos_customer_display/__openerp__.py new file mode 100755 index 00000000..3fb094b6 --- /dev/null +++ b/pos_customer_display/__openerp__.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + + +{ + 'name': 'POS Customer Display', + 'version': '0.1', + 'category': 'Point Of Sale', + 'summary': 'Manage Customer Display device from POS front end', + 'description': """ +POS Customer Display +==================== + +This module adds support for Customer Display in the Point of Sale. This module is designed to be installed on the *main Odoo server*. On the *POSbox*, you should install the module *hw_customer_display*. + +The number of rows and cols of the Customer Display (usually 2 x 20) should be configured on the main Odoo server, in the menu Point of Sale > Configuration > Point of Sales. + +It has been tested with a Bixolon BCD-1100 (http://www.bixolon.com/html/en/product/product_detail.xhtml?prod_id=61), but should support most serial and USB-serial LCD displays out-of-the-box or with inheritance of a few functions. To setup the BCD-1100 on Linux, you will find some technical instructions on this page : http://techtuxwords.blogspot.fr/2012/12/linux-and-bixolon-bcd-1100.html + +This module has been developped during a POS code sprint at Akretion France from July 7th to July 10th 2014. This module is part of the POS project of the Odoo Community Association http://odoo-community.org/. You are invited to become a member and/or get involved in the Association ! + +Please contact Alexis de Lattre from Akretion for any help or question about this module. + """, + 'author': 'Aurélien DUMAINE', + 'depends': ['point_of_sale'], + 'data' : ['pos_customer_display.xml', + 'customer_display_view.xml'], +} diff --git a/pos_customer_display/customer_display_view.xml b/pos_customer_display/customer_display_view.xml new file mode 100644 index 00000000..80b238a6 --- /dev/null +++ b/pos_customer_display/customer_display_view.xml @@ -0,0 +1,16 @@ + + + + + pos.config.form.view.inherit + pos.config + + + + + + + + + + diff --git a/pos_customer_display/pos_customer_display.py b/pos_customer_display/pos_customer_display.py new file mode 100644 index 00000000..20eda083 --- /dev/null +++ b/pos_customer_display/pos_customer_display.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SP (). +# +# 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 . +# +############################################################################## + +import logging +import time + +from openerp import tools +from openerp.osv import fields, osv +from openerp.tools.translate import _ + +import openerp.addons.decimal_precision as dp +import openerp.addons.product.product + +_logger = logging.getLogger(__name__) + +class pos_config(osv.osv): + _name = 'pos.config' + _inherit = 'pos.config' + + _columns = { + 'iface_customer_display' : fields.boolean('Customer display', help="Display data on the customer display"), + 'customer_display_line_length' : fields.integer('Line length', help="Length of the LEDs lines of the customer display"), + } + _defaults = { + 'customer_display_line_length' : 20, + } + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/pos_customer_display/pos_customer_display.xml b/pos_customer_display/pos_customer_display.xml new file mode 100755 index 00000000..3aaa679e --- /dev/null +++ b/pos_customer_display/pos_customer_display.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js new file mode 100755 index 00000000..73dc914a --- /dev/null +++ b/pos_customer_display/static/src/js/customer_display.js @@ -0,0 +1,264 @@ +openerp.pos_customer_display = function(instance){ + module = instance.point_of_sale; + + var _t = instance.web._t; + var round_di = instance.web.round_decimals; + var round_pr = instance.web.round_precision + + + module.PosModel = module.PosModel.extend({ + prepare_text_customer_display: function(type, data){ + if (this.config.iface_customer_display != true) + return; + var line_length = this.config.customer_display_line_length || 20; + var currency_rounding = Math.ceil(Math.log(1.0 / this.currency.rounding) / Math.log(10)); + + if (type == 'addProduct'){ + // in order to not recompute qty in options..., we assume that the new ordeLine is the last of the collection + // addOrderline exists but is not called by addProduct, should we handle it ? + var line = this.get('selectedOrder').getLastOrderline(); + var price_unit = line.get_quantity() * line.get_unit_price() * (1.0 - (line.get_discount() / 100.0)); + price_unit = price_unit.toFixed(currency_rounding); + var l21 = line.get_quantity_str_with_unit() + ' x ' + price_unit; + var l22 = ' ' + line.get_display_price().toFixed(currency_rounding); + var lines_to_send = new Array( + this.proxy.complete_string_right(line.get_product().name, line_length), + this.proxy.complete_string_right(l21, line_length - l22.length) + l22 + ); + } else if (type == 'removeOrderline') { + // FIXME : first click on the backspace button set the amount to 0 + var line = data['line']; + var price_unit = line.get_quantity() * line.get_unit_price() * (1.0 - (line.get_discount() / 100.0)); + price_unit = price_unit.toFixed(currency_rounding); + var l21 = '-' + line.get_quantity_str_with_unit() + ' x ' + price_unit; + var l22 = ' ' + -1 * line.get_display_price().toFixed(currency_rounding); + var lines_to_send = new Array( + this.proxy.complete_string_right(line.get_product().name, line_length), + this.proxy.complete_string_right(l21, line_length - l22.length) + l22 + ); + } else if (type == 'addPaymentline') { + var cashregister = data['cashregister']; + var total = this.get('selectedOrder').getTotalTaxIncluded().toFixed(currency_rounding); + var lines_to_send = new Array( + this.proxy.complete_string_right(_t("TOTAL : "), line_length - 1 - total.length) + ' ' + total, + this.proxy.complete_string_right(_t("Paiement :"), line_length - 1 - cashregister.journal_id[1].length) + ' ' + cashregister.journal_id[1] + ); + + } else if (type == 'removePaymentline') { + var line = data['line']; + var amount = line.get_amount().toFixed(currency_rounding); + var lines_to_send = new Array( + this.proxy.complete_string_right(_t("Suppression paiement"), line_length), + this.proxy.complete_string_right(line.cashregister.journal_id[1] , line_length - 1- amount.length) + ' ' + amount + ); + } else if (type == 'pushOrder') { + var currentOrder = data['currentOrder']; + var paidTotal = currentOrder.getPaidTotal(); + var dueTotal = currentOrder.getTotalTaxIncluded(); + var remaining = dueTotal > paidTotal ? dueTotal - paidTotal : 0; + var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0; + + var l1; + if (change == 0){ + l1 = this.proxy.complete_string_center(_t(""), line_length); + } else { + change = change.toFixed(currency_rounding); + l1 = this.proxy.complete_string_right(_t("YOUR CHANGE :"), line_length - 1 - change.length) + ' ' + change; + } + + var lines_to_send = new Array( + l1, + this.proxy.complete_string_center(_t("Next customer..."), line_length) + ); + } else if (type = 'closePOS') { + var lines_to_send = new Array( + this.proxy.complete_string_center(_t("Point of sale closed"), line_length), + this.proxy.complete_string_center(_t("***"), line_length) + ); + } else { + console.warn('Unknown message type'); + return; + } + + this.proxy.send_text_customer_display(lines_to_send, line_length); + }, + + }); + + + module.ProxyDevice = module.ProxyDevice.extend({ + send_text_customer_display: function(data, line_length){ + if (data[0].length != line_length || data[1].length != line_length){ + console.warn("Data components have to have " + line_length + " chars."); + console.log(data[0].length + " -> "+ data[0] + "\n" + data[1].length + " -> " + data[1]); + } else { + //alert(JSON.stringify(data)); + return this.message('send_text_customer_display', {'text_to_display' : JSON.stringify(data)}); + } + return; + }, + complete_string_right: function(string, length){ + if (string.length > length) + { + return string.substring(0,length); + } + else if (string.length < length) + { + while(string.length < length) + string = string+' '; + return string; + } + return string; + }, + complete_string_left: function(string, length){ + if (string.length > length) + { + return string.substring(0,length); + } + else if (string.length < length) + { + while(string.length < length) + string = ' '+string; + return string; + } + return string; + }, + complete_string_center: function(string, length){ + var self = this; + if (string.length > length) + { + return string.substring(0,length); + } + else if (string.length < length) + { + ini = (length - string.length)/2; + while(string.length < length - ini) + string = ' '+string; + while(string.length < length) + string = string + ' '; + return string; + } + return string; + }, + }); + + + var _super_setSmartStatus_ = module.ProxyStatusWidget.prototype.set_smart_status; + module.ProxyStatusWidget.prototype.set_smart_status = function(status){ + _super_setSmartStatus_.call(this, status); + if(status.status === 'connected'){ + var warning = false; + var msg = '' + if( this.pos.config.iface_customer_display){ + var customer_display = status.drivers.customer_display ? status.drivers.customer_display.status : false; + if( customer_display != 'connected' && customer_display != 'connecting'){ + warning = true; + msg = msg ? msg + ' & ' : msg; + msg += _t('Customer display'); + } + } + msg = msg ? msg + ' ' + _t('Offline') : msg; + this.set_status(warning ? 'warning' : 'connected', msg); + }else{ + this.set_status(status.status,''); + } + }; + + + var _super_addProduct_ = module.Order.prototype.addProduct; + module.Order.prototype.addProduct = function(product, options){ + _super_addProduct_.call(this, product, options); + this.pos.prepare_text_customer_display('addProduct', {'product' : product, 'options' : options}); + }; + + + var _super_removeOrderline_ = module.Order.prototype.removeOrderline; + module.Order.prototype.removeOrderline = function(line){ + this.pos.prepare_text_customer_display('removeOrderline', {'line' : line}); + _super_removeOrderline_.call(this, line); + }; + + var _super_removePaymentline_ = module.Order.prototype.removePaymentline; + module.Order.prototype.removePaymentline = function(line){ + this.pos.prepare_text_customer_display('removePaymentline', {'line' : line}); + _super_removePaymentline_.call(this, line); + }; + + var _super_addPaymentline_ = module.Order.prototype.addPaymentline; + module.Order.prototype.addPaymentline = function(cashregister){ + _super_addPaymentline_.call(this, cashregister); + this.pos.prepare_text_customer_display('addPaymentline', {'cashregister' : cashregister}); + }; + + + var _super_pushOrder_ = module.PosModel.prototype.push_order; + module.PosModel.prototype.push_order = function(currentOrder){ + _super_pushOrder_.call(this, currentOrder); + this.prepare_text_customer_display('pushOrder', {'currentOrder' : currentOrder}); + + }; + + + var _super_closePOS_ = module.PosWidget.prototype.close; + module.PosWidget.prototype.close = function(){ + this.pos.prepare_text_customer_display('closePOS', {}); + _super_closePOS_.call(this); + }; + +/* + var _super_updatePayment_ = module.PaymentScreenWidget.prototype.update_payment_summary; + module.PaymentScreenWidget.prototype.update_payment_summary = function(){ + _super_updatePayement_.call(this); + if( this.pos.config.iface_customer_display != true ) + return; + var currentOrder = this.pos.get('selectedOrder'); + var paidTotal = currentOrder.getPaidTotal(); + var dueTotal = currentOrder.getTotalTaxIncluded(); + var remaining = dueTotal > paidTotal ? dueTotal - paidTotal : 0; + var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0; + + var currency_rounding = Math.ceil(Math.log(1.0 / this.pos.currency.rounding) / Math.log(10)); + var amount = line.get_amount().toFixed(currency_rounding); + var line_length = this.pos.config.customer_display_line_length || 20; + var data = new Array( + this.pos.proxy.complete_string_right(_t("Suppression paiement"), line_length), + this.pos.proxy.complete_string_right(line.cashregister.journal_id[1] , line_length - amount.length) + ' ' + amount + ); + this.pos.proxy.send_text_customer_display(data); + }; +*/ +/* + module.Paymentline = module.Paymentline.extend({ + set_pos: function(pos){ + this.pos = pos; + }, + }); + + module.PaypadButtonWidget = module.PaypadButtonWidget.extend({ + renderElement: function() { + var self = this; + this._super(); + + this.$el.click(function(){ + if (self.pos.get('selectedOrder').get('screen') === 'receipt'){ //TODO Why ? + console.warn('TODO should not get there...?'); + return; + } + self.pos.get('selectedOrder').addPaymentline(self.cashregister); + console.log('aurel'); + self.pos.get('selectedOrder').get('paymentLines').at(self.pos.get('selectedOrder').get('paymentLines').length -1).set_pos(self.pos); + console.log('aurel'); + self.pos_widget.screen_selector.set_current_screen('payment'); + }); + }, + }); + + var _super_setamountPaymentline_ = module.Paymentline.prototype.set_amount; + module.Paymentline.prototype.set_amount = function(amount){ + _super_setamountPaymentline_.call(this, amount); + var data = _t("Add paymentline : ") + this.cashregister.journal_id[1] + " " + this.get_amount() + " " + this.pos.get('selectedOrder').getDueLeft(); + alert(data); + this.pos.proxy.send_text_customer_display(data); + }; +*/ +}; From f3244522553dd6a5294080d34dd35f5de96ddbb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Au=C3=A9lien=20DUMAINE?= Date: Thu, 10 Jul 2014 17:23:30 +0200 Subject: [PATCH 02/48] Initial check-in of the module pos_payment_terminal. --- .../static/src/js/customer_display.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index 73dc914a..8a135570 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -41,15 +41,15 @@ openerp.pos_customer_display = function(instance){ var total = this.get('selectedOrder').getTotalTaxIncluded().toFixed(currency_rounding); var lines_to_send = new Array( this.proxy.complete_string_right(_t("TOTAL : "), line_length - 1 - total.length) + ' ' + total, - this.proxy.complete_string_right(_t("Paiement :"), line_length - 1 - cashregister.journal_id[1].length) + ' ' + cashregister.journal_id[1] + this.proxy.complete_string_right(_t("Payment :"), line_length - 1 - cashregister.journal_id[1].length) + ' ' + cashregister.journal_id[1] ); } else if (type == 'removePaymentline') { var line = data['line']; var amount = line.get_amount().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.complete_string_right(_t("Suppression paiement"), line_length), - this.proxy.complete_string_right(line.cashregister.journal_id[1] , line_length - 1- amount.length) + ' ' + amount + this.proxy.complete_string_right(_t("Delete payment"), line_length), + this.proxy.complete_string_right(line.cashregister.journal_id[1] , line_length - 1 - amount.length) + ' ' + amount ); } else if (type == 'pushOrder') { var currentOrder = data['currentOrder']; @@ -80,6 +80,7 @@ openerp.pos_customer_display = function(instance){ return; } +// alert("aa" + line_length); this.proxy.send_text_customer_display(lines_to_send, line_length); }, @@ -88,11 +89,17 @@ openerp.pos_customer_display = function(instance){ module.ProxyDevice = module.ProxyDevice.extend({ send_text_customer_display: function(data, line_length){ + //FIXME : this function is call twice. The first time, it is not called by prepare_text_customer_display : WHY ? +// alert("bb" + line_length); + if (data[0].length != line_length) + console.warn(data[0].length + " " + data[0]); + if (data[1].length != line_length) + console.warn(data[1].length + " " + data[1]); if (data[0].length != line_length || data[1].length != line_length){ console.warn("Data components have to have " + line_length + " chars."); console.log(data[0].length + " -> "+ data[0] + "\n" + data[1].length + " -> " + data[1]); } else { - //alert(JSON.stringify(data)); +// alert(JSON.stringify(data)); return this.message('send_text_customer_display', {'text_to_display' : JSON.stringify(data)}); } return; @@ -143,6 +150,7 @@ openerp.pos_customer_display = function(instance){ }); + //FIXME : nothing append on customer display deconnection var _super_setSmartStatus_ = module.ProxyStatusWidget.prototype.set_smart_status; module.ProxyStatusWidget.prototype.set_smart_status = function(status){ _super_setSmartStatus_.call(this, status); From a6af3c86387e89ad1dc509e8bae4ee9816859a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Au=C3=A9lien=20DUMAINE?= Date: Fri, 11 Jul 2014 03:03:11 +0200 Subject: [PATCH 03/48] pos_customer_display bugfix : new massage on deleting orderLine and fixing unit_price computation on adding orderLine --- .../static/src/js/customer_display.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index 8a135570..ad2a9d06 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -17,7 +17,7 @@ openerp.pos_customer_display = function(instance){ // in order to not recompute qty in options..., we assume that the new ordeLine is the last of the collection // addOrderline exists but is not called by addProduct, should we handle it ? var line = this.get('selectedOrder').getLastOrderline(); - var price_unit = line.get_quantity() * line.get_unit_price() * (1.0 - (line.get_discount() / 100.0)); + var price_unit = line.get_unit_price() * (1.0 - (line.get_discount() / 100.0)); price_unit = price_unit.toFixed(currency_rounding); var l21 = line.get_quantity_str_with_unit() + ' x ' + price_unit; var l22 = ' ' + line.get_display_price().toFixed(currency_rounding); @@ -26,15 +26,11 @@ openerp.pos_customer_display = function(instance){ this.proxy.complete_string_right(l21, line_length - l22.length) + l22 ); } else if (type == 'removeOrderline') { - // FIXME : first click on the backspace button set the amount to 0 + // first click on the backspace button set the amount to 0 => we can't precise the deleted qunatity and price var line = data['line']; - var price_unit = line.get_quantity() * line.get_unit_price() * (1.0 - (line.get_discount() / 100.0)); - price_unit = price_unit.toFixed(currency_rounding); - var l21 = '-' + line.get_quantity_str_with_unit() + ' x ' + price_unit; - var l22 = ' ' + -1 * line.get_display_price().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.complete_string_right(line.get_product().name, line_length), - this.proxy.complete_string_right(l21, line_length - l22.length) + l22 + this.proxy.complete_string_center(_t("Delete item"), line_length), + this.proxy.complete_string_center(line.get_product().name, line_length) ); } else if (type == 'addPaymentline') { var cashregister = data['cashregister']; @@ -48,7 +44,7 @@ openerp.pos_customer_display = function(instance){ var line = data['line']; var amount = line.get_amount().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.complete_string_right(_t("Delete payment"), line_length), + this.proxy.complete_string_center(_t("Delete payment"), line_length), this.proxy.complete_string_right(line.cashregister.journal_id[1] , line_length - 1 - amount.length) + ' ' + amount ); } else if (type == 'pushOrder') { @@ -80,7 +76,7 @@ openerp.pos_customer_display = function(instance){ return; } -// alert("aa" + line_length); +// alert("In prepare_text_customer_display " + line_length); this.proxy.send_text_customer_display(lines_to_send, line_length); }, @@ -90,7 +86,7 @@ openerp.pos_customer_display = function(instance){ module.ProxyDevice = module.ProxyDevice.extend({ send_text_customer_display: function(data, line_length){ //FIXME : this function is call twice. The first time, it is not called by prepare_text_customer_display : WHY ? -// alert("bb" + line_length); +// alert("In sent_text_customer_display " + line_length); if (data[0].length != line_length) console.warn(data[0].length + " " + data[0]); if (data[1].length != line_length) From d0f07cfec29afd6c338aeec854f40f725ff6d93e Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 12 Jul 2014 00:29:04 +0200 Subject: [PATCH 04/48] Fix copyright headers PEP8 stuff --- pos_customer_display/__init__.py | 2 +- pos_customer_display/__openerp__.py | 14 +++++----- pos_customer_display/pos_customer_display.py | 28 +++++++++---------- pos_customer_display/pos_customer_display.xml | 0 4 files changed, 21 insertions(+), 23 deletions(-) mode change 100755 => 100644 pos_customer_display/__init__.py mode change 100755 => 100644 pos_customer_display/__openerp__.py mode change 100755 => 100644 pos_customer_display/pos_customer_display.xml diff --git a/pos_customer_display/__init__.py b/pos_customer_display/__init__.py old mode 100755 new mode 100644 index 7dff50a7..bb27ef75 --- a/pos_customer_display/__init__.py +++ b/pos_customer_display/__init__.py @@ -1 +1 @@ -import pos_customer_display +from . import pos_customer_display diff --git a/pos_customer_display/__openerp__.py b/pos_customer_display/__openerp__.py old mode 100755 new mode 100644 index 3fb094b6..3f0a7c1e --- a/pos_customer_display/__openerp__.py +++ b/pos_customer_display/__openerp__.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). +# POS Customer Display module for Odoo +# Copyright (C) 2014 Aurélien DUMAINE # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -33,14 +33,14 @@ This module adds support for Customer Display in the Point of Sale. This module The number of rows and cols of the Customer Display (usually 2 x 20) should be configured on the main Odoo server, in the menu Point of Sale > Configuration > Point of Sales. -It has been tested with a Bixolon BCD-1100 (http://www.bixolon.com/html/en/product/product_detail.xhtml?prod_id=61), but should support most serial and USB-serial LCD displays out-of-the-box or with inheritance of a few functions. To setup the BCD-1100 on Linux, you will find some technical instructions on this page : http://techtuxwords.blogspot.fr/2012/12/linux-and-bixolon-bcd-1100.html +It has been tested with a Bixolon BCD-1100 (http://www.bixolon.com/html/en/product/product_detail.xhtml?prod_id=61), but should support most serial and USB-serial LCD displays out-of-the-box, cf the module *hw_customer_display* for more info. This module has been developped during a POS code sprint at Akretion France from July 7th to July 10th 2014. This module is part of the POS project of the Odoo Community Association http://odoo-community.org/. You are invited to become a member and/or get involved in the Association ! - -Please contact Alexis de Lattre from Akretion for any help or question about this module. """, 'author': 'Aurélien DUMAINE', 'depends': ['point_of_sale'], - 'data' : ['pos_customer_display.xml', - 'customer_display_view.xml'], + 'data' : [ + 'pos_customer_display.xml', + 'customer_display_view.xml', + ], } diff --git a/pos_customer_display/pos_customer_display.py b/pos_customer_display/pos_customer_display.py index 20eda083..d2bcb43e 100644 --- a/pos_customer_display/pos_customer_display.py +++ b/pos_customer_display/pos_customer_display.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SP (). +# POS Customer Display module for Odoo +# Copyright (C) 2014 Aurélien DUMAINE # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -20,27 +20,25 @@ ############################################################################## import logging -import time - -from openerp import tools -from openerp.osv import fields, osv -from openerp.tools.translate import _ - -import openerp.addons.decimal_precision as dp -import openerp.addons.product.product +from openerp.osv import fields, orm _logger = logging.getLogger(__name__) -class pos_config(osv.osv): + +class pos_config(orm.Model): _name = 'pos.config' _inherit = 'pos.config' - + _columns = { - 'iface_customer_display' : fields.boolean('Customer display', help="Display data on the customer display"), - 'customer_display_line_length' : fields.integer('Line length', help="Length of the LEDs lines of the customer display"), + 'iface_customer_display': fields.boolean( + 'Customer display', help="Display data on the customer display"), + 'customer_display_line_length': fields.integer( + 'Line length', + help="Length of the LEDs lines of the customer display"), } + _defaults = { - 'customer_display_line_length' : 20, + 'customer_display_line_length': 20, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/pos_customer_display/pos_customer_display.xml b/pos_customer_display/pos_customer_display.xml old mode 100755 new mode 100644 From 52b0d8c6c68368417a4cd6599292bb39170a3d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Au=C3=A9lien=20DUMAINE?= Date: Sun, 20 Jul 2014 22:36:24 +0200 Subject: [PATCH 05/48] pos_payment_terminal : bigger button for start transaction with touchscreen --- pos_customer_display/static/src/js/customer_display.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index ad2a9d06..fd21fe07 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -88,9 +88,9 @@ openerp.pos_customer_display = function(instance){ //FIXME : this function is call twice. The first time, it is not called by prepare_text_customer_display : WHY ? // alert("In sent_text_customer_display " + line_length); if (data[0].length != line_length) - console.warn(data[0].length + " " + data[0]); + console.warn(data[0].length + " -> " + data[0]); if (data[1].length != line_length) - console.warn(data[1].length + " " + data[1]); + console.warn(data[1].length + " ->" + data[1]); if (data[0].length != line_length || data[1].length != line_length){ console.warn("Data components have to have " + line_length + " chars."); console.log(data[0].length + " -> "+ data[0] + "\n" + data[1].length + " -> " + data[1]); From e9c2313835ba8bf14850f70c8bca56e19bea28b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Au=C3=A9lien=20DUMAINE?= Date: Mon, 21 Jul 2014 22:12:06 +0200 Subject: [PATCH 06/48] Add french translation --- pos_customer_display/i18n/fr.po | 108 ++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 pos_customer_display/i18n/fr.po diff --git a/pos_customer_display/i18n/fr.po b/pos_customer_display/i18n/fr.po new file mode 100644 index 00000000..9fa4cc09 --- /dev/null +++ b/pos_customer_display/i18n/fr.po @@ -0,0 +1,108 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * pos_customer_display +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 9.0alpha1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-07-21 10:50+0000\n" +"PO-Revision-Date: 2014-07-21 10:50+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: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:72 +#, python-format +msgid "***" +msgstr "***" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:161 +#: field:pos.config,iface_customer_display:0 +#, python-format +msgid "Customer display" +msgstr "Afficheur client" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:32 +#, python-format +msgid "Delete item" +msgstr "Suppression article" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:47 +#, python-format +msgid "Delete payment" +msgstr "Suppression paiement" + +#. module: pos_customer_display +#: help:pos.config,iface_customer_display:0 +msgid "Display data on the customer display" +msgstr "Afficher les info sur l'afficheur client" + +#. module: pos_customer_display +#: help:pos.config,customer_display_line_length:0 +msgid "Length of the LEDs lines of the customer display" +msgstr "Longueur des lignes de l'afficheur client, nombre de caractères" + +#. module: pos_customer_display +#: field:pos.config,customer_display_line_length:0 +msgid "Line length" +msgstr "Longueur des lignes" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:67 +#, python-format +msgid "Next customer..." +msgstr "Client suivant..." + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:164 +#, python-format +msgid "Offline" +msgstr "Hors ligne" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:40 +#, python-format +msgid "Payment :" +msgstr "Paiement :" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:71 +#, python-format +msgid "Point of sale closed" +msgstr "Caisse fermée" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:39 +#, python-format +msgid "TOTAL : " +msgstr "TOTAL : " + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:62 +#, python-format +msgid "YOUR CHANGE :" +msgstr "VOTRE MONNAIE :" + +#. module: pos_customer_display +#: model:ir.model,name:pos_customer_display.model_pos_config +msgid "pos.config" +msgstr "pos.config" + From 475693749ebda55c8534fc3e4b40c4d58dced362 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 1 Sep 2014 13:31:03 +0200 Subject: [PATCH 07/48] FIX Adapt JS code to recent changes in the code of POS v8 Update module description with my recent tests with new hardware --- pos_customer_display/static/src/js/customer_display.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index fd21fe07..829e6407 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -22,7 +22,7 @@ openerp.pos_customer_display = function(instance){ var l21 = line.get_quantity_str_with_unit() + ' x ' + price_unit; var l22 = ' ' + line.get_display_price().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.complete_string_right(line.get_product().name, line_length), + this.proxy.complete_string_right(line.get_product().display_name, line_length), this.proxy.complete_string_right(l21, line_length - l22.length) + l22 ); } else if (type == 'removeOrderline') { @@ -36,8 +36,8 @@ openerp.pos_customer_display = function(instance){ var cashregister = data['cashregister']; var total = this.get('selectedOrder').getTotalTaxIncluded().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.complete_string_right(_t("TOTAL : "), line_length - 1 - total.length) + ' ' + total, - this.proxy.complete_string_right(_t("Payment :"), line_length - 1 - cashregister.journal_id[1].length) + ' ' + cashregister.journal_id[1] + this.proxy.complete_string_right(_t("TOTAL: "), line_length - 1 - total.length) + ' ' + total, + this.proxy.complete_string_right(_t("Payment:"), line_length - 1 - cashregister.journal_id[1].length) + ' ' + cashregister.journal_id[1] ); } else if (type == 'removePaymentline') { @@ -172,7 +172,7 @@ openerp.pos_customer_display = function(instance){ var _super_addProduct_ = module.Order.prototype.addProduct; module.Order.prototype.addProduct = function(product, options){ _super_addProduct_.call(this, product, options); - this.pos.prepare_text_customer_display('addProduct', {'product' : product, 'options' : options}); + this.pos.prepare_text_customer_display('addProduct', {'product' : product, 'options' : options}); }; From 9ab59c37e81d2f12311936414dc70c51f6e2d0f6 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 22 Oct 2014 21:47:15 +0200 Subject: [PATCH 08/48] pos_payment_terminal: add missing css file pos_customer_display: FIX JS code and make it more robust --- .../static/src/js/customer_display.js | 351 ++++++++---------- 1 file changed, 153 insertions(+), 198 deletions(-) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index 829e6407..6170a360 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -3,104 +3,103 @@ openerp.pos_customer_display = function(instance){ var _t = instance.web._t; var round_di = instance.web.round_decimals; - var round_pr = instance.web.round_precision + var round_pr = instance.web.round_precision; module.PosModel = module.PosModel.extend({ - prepare_text_customer_display: function(type, data){ - if (this.config.iface_customer_display != true) - return; - var line_length = this.config.customer_display_line_length || 20; - var currency_rounding = Math.ceil(Math.log(1.0 / this.currency.rounding) / Math.log(10)); - - if (type == 'addProduct'){ - // in order to not recompute qty in options..., we assume that the new ordeLine is the last of the collection - // addOrderline exists but is not called by addProduct, should we handle it ? - var line = this.get('selectedOrder').getLastOrderline(); - var price_unit = line.get_unit_price() * (1.0 - (line.get_discount() / 100.0)); - price_unit = price_unit.toFixed(currency_rounding); - var l21 = line.get_quantity_str_with_unit() + ' x ' + price_unit; - var l22 = ' ' + line.get_display_price().toFixed(currency_rounding); - var lines_to_send = new Array( - this.proxy.complete_string_right(line.get_product().display_name, line_length), - this.proxy.complete_string_right(l21, line_length - l22.length) + l22 - ); - } else if (type == 'removeOrderline') { - // first click on the backspace button set the amount to 0 => we can't precise the deleted qunatity and price - var line = data['line']; - var lines_to_send = new Array( - this.proxy.complete_string_center(_t("Delete item"), line_length), - this.proxy.complete_string_center(line.get_product().name, line_length) - ); - } else if (type == 'addPaymentline') { - var cashregister = data['cashregister']; - var total = this.get('selectedOrder').getTotalTaxIncluded().toFixed(currency_rounding); - var lines_to_send = new Array( - this.proxy.complete_string_right(_t("TOTAL: "), line_length - 1 - total.length) + ' ' + total, - this.proxy.complete_string_right(_t("Payment:"), line_length - 1 - cashregister.journal_id[1].length) + ' ' + cashregister.journal_id[1] - ); - - } else if (type == 'removePaymentline') { - var line = data['line']; - var amount = line.get_amount().toFixed(currency_rounding); - var lines_to_send = new Array( - this.proxy.complete_string_center(_t("Delete payment"), line_length), - this.proxy.complete_string_right(line.cashregister.journal_id[1] , line_length - 1 - amount.length) + ' ' + amount - ); - } else if (type == 'pushOrder') { - var currentOrder = data['currentOrder']; - var paidTotal = currentOrder.getPaidTotal(); - var dueTotal = currentOrder.getTotalTaxIncluded(); - var remaining = dueTotal > paidTotal ? dueTotal - paidTotal : 0; - var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0; - - var l1; - if (change == 0){ - l1 = this.proxy.complete_string_center(_t(""), line_length); - } else { - change = change.toFixed(currency_rounding); - l1 = this.proxy.complete_string_right(_t("YOUR CHANGE :"), line_length - 1 - change.length) + ' ' + change; - } - - var lines_to_send = new Array( - l1, - this.proxy.complete_string_center(_t("Next customer..."), line_length) - ); - } else if (type = 'closePOS') { - var lines_to_send = new Array( - this.proxy.complete_string_center(_t("Point of sale closed"), line_length), - this.proxy.complete_string_center(_t("***"), line_length) - ); - } else { - console.warn('Unknown message type'); - return; - } + prepare_text_customer_display: function(type, data){ + if (this.config.iface_customer_display != true) + return; + var line_length = this.config.customer_display_line_length || 20; + var currency_rounding = Math.ceil(Math.log(1.0 / this.currency.rounding) / Math.log(10)); + + if (type == 'addProduct'){ + // in order to not recompute qty in options..., we assume that the new ordeLine is the last of the collection + // addOrderline exists but is not called by addProduct, should we handle it ? + var line = this.get('selectedOrder').getLastOrderline(); + var price_unit = line.get_unit_price() * (1.0 - (line.get_discount() / 100.0)); + price_unit = price_unit.toFixed(currency_rounding); + var l21 = line.get_quantity_str_with_unit() + ' x ' + price_unit; + var l22 = ' ' + line.get_display_price().toFixed(currency_rounding); + var lines_to_send = new Array( + this.proxy.complete_string_right(line.get_product().display_name, line_length), + this.proxy.complete_string_right(l21, line_length - l22.length) + l22 + ); + + } else if (type == 'removeOrderline') { + // first click on the backspace button set the amount to 0 => we can't precise the deleted qunatity and price + var line = data['line']; + var lines_to_send = new Array( + this.proxy.complete_string_center(_t("Delete item"), line_length), + this.proxy.complete_string_center(line.get_product().name, line_length) + ); + + } else if (type == 'addPaymentline') { + var cashregister = data['cashregister']; + var total = this.get('selectedOrder').getTotalTaxIncluded().toFixed(currency_rounding); + var lines_to_send = new Array( + this.proxy.complete_string_right(_t("TOTAL: "), line_length - 1 - total.length) + ' ' + total, + this.proxy.complete_string_right(_t("Payment:"), line_length - 1 - cashregister.journal_id[1].length) + ' ' + cashregister.journal_id[1] + ); + + } else if (type == 'removePaymentline') { + var line = data['line']; + var amount = line.get_amount().toFixed(currency_rounding); + var lines_to_send = new Array( + this.proxy.complete_string_center(_t("Delete payment"), line_length), + this.proxy.complete_string_right(line.cashregister.journal_id[1] , line_length - 1 - amount.length) + ' ' + amount + ); + + } else if (type == 'pushOrder') { + var order = data['order']; + var paidTotal = order.getPaidTotal(); + var dueTotal = order.getTotalTaxIncluded(); + var remaining = dueTotal > paidTotal ? dueTotal - paidTotal : 0; + var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0; + + var l1; + if (change == 0){ + l1 = this.proxy.complete_string_center(_t(""), line_length); + } else { + change = change.toFixed(currency_rounding); + l1 = this.proxy.complete_string_right(_t("YOUR CHANGE:"), line_length - 1 - change.length) + ' ' + change; + } + + var lines_to_send = new Array( + l1, + this.proxy.complete_string_center(_t("Next customer..."), line_length) + ); + + } else if (type = 'closePOS') { + var lines_to_send = new Array( + this.proxy.complete_string_center(_t("Point of sale closed"), line_length), + this.proxy.complete_string_center(_t("***"), line_length) + ); + } else { + console.warn('Unknown message type'); + return; + } -// alert("In prepare_text_customer_display " + line_length); - this.proxy.send_text_customer_display(lines_to_send, line_length); - }, +// alert("In prepare_text_customer_display " + line_length); + this.proxy.send_text_customer_display(lines_to_send, line_length); + }, - }); + }); module.ProxyDevice = module.ProxyDevice.extend({ send_text_customer_display: function(data, line_length){ - //FIXME : this function is call twice. The first time, it is not called by prepare_text_customer_display : WHY ? -// alert("In sent_text_customer_display " + line_length); - if (data[0].length != line_length) - console.warn(data[0].length + " -> " + data[0]); - if (data[1].length != line_length) - console.warn(data[1].length + " ->" + data[1]); - if (data[0].length != line_length || data[1].length != line_length){ - console.warn("Data components have to have " + line_length + " chars."); - console.log(data[0].length + " -> "+ data[0] + "\n" + data[1].length + " -> " + data[1]); + //FIXME : this function is call twice. The first time, it is not called by prepare_text_customer_display : WHY ? + if (_.isEmpty(data) || data.lenght != 2 || data[0].length != line_length || data[1].length != line_length){ + console.warn("Bad Data argument. Data = " + data); + console.warn('Line_length = ' + line_length); } else { -// alert(JSON.stringify(data)); - return this.message('send_text_customer_display', {'text_to_display' : JSON.stringify(data)}); - } - return; +// alert(JSON.stringify(data)); + return this.message('send_text_customer_display', {'text_to_display' : JSON.stringify(data)}); + } }, complete_string_right: function(string, length){ + if (string) { if (string.length > length) { return string.substring(0,length); @@ -108,161 +107,117 @@ openerp.pos_customer_display = function(instance){ else if (string.length < length) { while(string.length < length) - string = string+' '; + string = string + ' '; return string; } - return string; + } + return string; }, complete_string_left: function(string, length){ - if (string.length > length) - { + if (string) { + if (string.length > length) + { return string.substring(0,length); - } - else if (string.length < length) - { + } + else if (string.length < length) + { while(string.length < length) - string = ' '+string; + string = ' ' + string; return string; + } } return string; }, complete_string_center: function(string, length){ - var self = this; - if (string.length > length) - { - return string.substring(0,length); - } - else if (string.length < length) - { - ini = (length - string.length)/2; - while(string.length < length - ini) - string = ' '+string; - while(string.length < length) - string = string + ' '; - return string; + if (string) { + if (string.length > length) + { + return string.substring(0, length); + } + else if (string.length < length) + { + ini = (length - string.length) / 2; + while(string.length < length - ini) + string = ' ' + string; + while(string.length < length) + string = string + ' '; + return string; + } } return string; }, - }); + }); - //FIXME : nothing append on customer display deconnection + //FIXME : nothing happen on customer display deconnection var _super_setSmartStatus_ = module.ProxyStatusWidget.prototype.set_smart_status; module.ProxyStatusWidget.prototype.set_smart_status = function(status){ _super_setSmartStatus_.call(this, status); - if(status.status === 'connected'){ - var warning = false; - var msg = '' - if( this.pos.config.iface_customer_display){ - var customer_display = status.drivers.customer_display ? status.drivers.customer_display.status : false; - if( customer_display != 'connected' && customer_display != 'connecting'){ - warning = true; - msg = msg ? msg + ' & ' : msg; - msg += _t('Customer display'); - } - } - msg = msg ? msg + ' ' + _t('Offline') : msg; - this.set_status(warning ? 'warning' : 'connected', msg); - }else{ - this.set_status(status.status,''); - } + if (status.status === 'connected') { + var warning = false; + var msg = ''; + if (this.pos.config.iface_customer_display) { + var customer_display = status.drivers.customer_display ? status.drivers.customer_display.status : false; + if (customer_display != 'connected' && customer_display != 'connecting') { + warning = true; + msg = msg ? msg + ' & ' : msg; + msg += _t('Customer display'); + } + } + msg = msg ? msg + ' ' + _t('Offline') : msg; + this.set_status(warning ? 'warning' : 'connected', msg); + } else { + this.set_status(status.status, ''); + } }; - var _super_addProduct_ = module.Order.prototype.addProduct; module.Order.prototype.addProduct = function(product, options){ - _super_addProduct_.call(this, product, options); - this.pos.prepare_text_customer_display('addProduct', {'product' : product, 'options' : options}); + res = _super_addProduct_.call(this, product, options); + if (product) { + this.pos.prepare_text_customer_display('addProduct', {'product' : product, 'options' : options}); + } + return res; }; - var _super_removeOrderline_ = module.Order.prototype.removeOrderline; module.Order.prototype.removeOrderline = function(line){ - this.pos.prepare_text_customer_display('removeOrderline', {'line' : line}); - _super_removeOrderline_.call(this, line); + if (line) { + this.pos.prepare_text_customer_display('removeOrderline', {'line' : line}); + } + return _super_removeOrderline_.call(this, line); }; var _super_removePaymentline_ = module.Order.prototype.removePaymentline; module.Order.prototype.removePaymentline = function(line){ - this.pos.prepare_text_customer_display('removePaymentline', {'line' : line}); - _super_removePaymentline_.call(this, line); + if (line) { + this.pos.prepare_text_customer_display('removePaymentline', {'line' : line}); + } + return _super_removePaymentline_.call(this, line); }; var _super_addPaymentline_ = module.Order.prototype.addPaymentline; module.Order.prototype.addPaymentline = function(cashregister){ - _super_addPaymentline_.call(this, cashregister); - this.pos.prepare_text_customer_display('addPaymentline', {'cashregister' : cashregister}); + res = _super_addPaymentline_.call(this, cashregister); + if (cashregister) { + this.pos.prepare_text_customer_display('addPaymentline', {'cashregister' : cashregister}); + } + return res; }; - var _super_pushOrder_ = module.PosModel.prototype.push_order; - module.PosModel.prototype.push_order = function(currentOrder){ - _super_pushOrder_.call(this, currentOrder); - this.prepare_text_customer_display('pushOrder', {'currentOrder' : currentOrder}); - + module.PosModel.prototype.push_order = function(order){ + res = _super_pushOrder_.call(this, order); + if (order) { + this.prepare_text_customer_display('pushOrder', {'order' : order}); + } + return res; }; - var _super_closePOS_ = module.PosWidget.prototype.close; module.PosWidget.prototype.close = function(){ this.pos.prepare_text_customer_display('closePOS', {}); - _super_closePOS_.call(this); + return _super_closePOS_.call(this); }; -/* - var _super_updatePayment_ = module.PaymentScreenWidget.prototype.update_payment_summary; - module.PaymentScreenWidget.prototype.update_payment_summary = function(){ - _super_updatePayement_.call(this); - if( this.pos.config.iface_customer_display != true ) - return; - var currentOrder = this.pos.get('selectedOrder'); - var paidTotal = currentOrder.getPaidTotal(); - var dueTotal = currentOrder.getTotalTaxIncluded(); - var remaining = dueTotal > paidTotal ? dueTotal - paidTotal : 0; - var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0; - - var currency_rounding = Math.ceil(Math.log(1.0 / this.pos.currency.rounding) / Math.log(10)); - var amount = line.get_amount().toFixed(currency_rounding); - var line_length = this.pos.config.customer_display_line_length || 20; - var data = new Array( - this.pos.proxy.complete_string_right(_t("Suppression paiement"), line_length), - this.pos.proxy.complete_string_right(line.cashregister.journal_id[1] , line_length - amount.length) + ' ' + amount - ); - this.pos.proxy.send_text_customer_display(data); - }; -*/ -/* - module.Paymentline = module.Paymentline.extend({ - set_pos: function(pos){ - this.pos = pos; - }, - }); - - module.PaypadButtonWidget = module.PaypadButtonWidget.extend({ - renderElement: function() { - var self = this; - this._super(); - - this.$el.click(function(){ - if (self.pos.get('selectedOrder').get('screen') === 'receipt'){ //TODO Why ? - console.warn('TODO should not get there...?'); - return; - } - self.pos.get('selectedOrder').addPaymentline(self.cashregister); - console.log('aurel'); - self.pos.get('selectedOrder').get('paymentLines').at(self.pos.get('selectedOrder').get('paymentLines').length -1).set_pos(self.pos); - console.log('aurel'); - self.pos_widget.screen_selector.set_current_screen('payment'); - }); - }, - }); - - var _super_setamountPaymentline_ = module.Paymentline.prototype.set_amount; - module.Paymentline.prototype.set_amount = function(amount){ - _super_setamountPaymentline_.call(this, amount); - var data = _t("Add paymentline : ") + this.cashregister.journal_id[1] + " " + this.get_amount() + " " + this.pos.get('selectedOrder').getDueLeft(); - alert(data); - this.pos.proxy.send_text_customer_display(data); - }; -*/ }; From 1dc4ca8031fdd60b74424fcd1075161023073ba4 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 24 Oct 2014 12:05:08 +0200 Subject: [PATCH 09/48] [FIX] lenght -> length [IMP] Change is now displayed on the LCD when entered (avoid to keep displaying the change with the "next customer") Rename function names to easier understanding --- .../static/src/js/customer_display.js | 73 ++++++++++--------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index 6170a360..aa58ed7e 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -2,8 +2,6 @@ openerp.pos_customer_display = function(instance){ module = instance.point_of_sale; var _t = instance.web._t; - var round_di = instance.web.round_decimals; - var round_pr = instance.web.round_precision; module.PosModel = module.PosModel.extend({ @@ -22,58 +20,51 @@ openerp.pos_customer_display = function(instance){ var l21 = line.get_quantity_str_with_unit() + ' x ' + price_unit; var l22 = ' ' + line.get_display_price().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.complete_string_right(line.get_product().display_name, line_length), - this.proxy.complete_string_right(l21, line_length - l22.length) + l22 + this.proxy.align_left(line.get_product().display_name, line_length), + this.proxy.align_left(l21, line_length - l22.length) + l22 ); } else if (type == 'removeOrderline') { // first click on the backspace button set the amount to 0 => we can't precise the deleted qunatity and price var line = data['line']; var lines_to_send = new Array( - this.proxy.complete_string_center(_t("Delete item"), line_length), - this.proxy.complete_string_center(line.get_product().name, line_length) + this.proxy.align_center(_t("Delete item"), line_length), + this.proxy.align_center(line.get_product().name, line_length) ); } else if (type == 'addPaymentline') { var cashregister = data['cashregister']; var total = this.get('selectedOrder').getTotalTaxIncluded().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.complete_string_right(_t("TOTAL: "), line_length - 1 - total.length) + ' ' + total, - this.proxy.complete_string_right(_t("Payment:"), line_length - 1 - cashregister.journal_id[1].length) + ' ' + cashregister.journal_id[1] + this.proxy.align_left(_t("TOTAL: "), line_length - 1 - total.length) + ' ' + total, + this.proxy.align_left(_t("Payment:"), line_length - 1 - cashregister.journal_id[1].length) + ' ' + cashregister.journal_id[1] ); } else if (type == 'removePaymentline') { var line = data['line']; var amount = line.get_amount().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.complete_string_center(_t("Delete payment"), line_length), - this.proxy.complete_string_right(line.cashregister.journal_id[1] , line_length - 1 - amount.length) + ' ' + amount + this.proxy.align_center(_t("Delete payment"), line_length), + this.proxy.align_left(line.cashregister.journal_id[1] , line_length - 1 - amount.length) + ' ' + amount ); - } else if (type == 'pushOrder') { - var order = data['order']; - var paidTotal = order.getPaidTotal(); - var dueTotal = order.getTotalTaxIncluded(); - var remaining = dueTotal > paidTotal ? dueTotal - paidTotal : 0; - var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0; - - var l1; - if (change == 0){ - l1 = this.proxy.complete_string_center(_t(""), line_length); - } else { - change = change.toFixed(currency_rounding); - l1 = this.proxy.complete_string_right(_t("YOUR CHANGE:"), line_length - 1 - change.length) + ' ' + change; - } + } else if (type == 'update_payment') { + var change = data['change']; + var lines_to_send = new Array( + this.proxy.align_left(_t("Your Change:"), line_length), + this.proxy.align_right(change, line_length) + ); + } else if (type == 'pushOrder') { var lines_to_send = new Array( - l1, - this.proxy.complete_string_center(_t("Next customer..."), line_length) + this.proxy.align_center(_t("Next customer"), line_length), + '' ); - } else if (type = 'closePOS') { - var lines_to_send = new Array( - this.proxy.complete_string_center(_t("Point of sale closed"), line_length), - this.proxy.complete_string_center(_t("***"), line_length) + } else if (type = 'closePOS') { + var lines_to_send = new Array( + this.proxy.align_center(_t("Point of sale closed"), line_length), + '' ); } else { console.warn('Unknown message type'); @@ -90,7 +81,7 @@ openerp.pos_customer_display = function(instance){ module.ProxyDevice = module.ProxyDevice.extend({ send_text_customer_display: function(data, line_length){ //FIXME : this function is call twice. The first time, it is not called by prepare_text_customer_display : WHY ? - if (_.isEmpty(data) || data.lenght != 2 || data[0].length != line_length || data[1].length != line_length){ + if (_.isEmpty(data) || data.length != 2 || data[0].length != line_length || data[1].length != line_length){ console.warn("Bad Data argument. Data = " + data); console.warn('Line_length = ' + line_length); } else { @@ -98,7 +89,7 @@ openerp.pos_customer_display = function(instance){ return this.message('send_text_customer_display', {'text_to_display' : JSON.stringify(data)}); } }, - complete_string_right: function(string, length){ + align_left: function(string, length){ if (string) { if (string.length > length) { @@ -113,7 +104,7 @@ openerp.pos_customer_display = function(instance){ } return string; }, - complete_string_left: function(string, length){ + align_right: function(string, length){ if (string) { if (string.length > length) { @@ -128,7 +119,7 @@ openerp.pos_customer_display = function(instance){ } return string; }, - complete_string_center: function(string, length){ + align_center: function(string, length){ if (string) { if (string.length > length) { @@ -214,6 +205,20 @@ openerp.pos_customer_display = function(instance){ return res; }; + var _super_update_payment_summary_ = module.PaymentScreenWidget.prototype.update_payment_summary; + module.PaymentScreenWidget.prototype.update_payment_summary = function(){ + res = _super_update_payment_summary_.call(this); + var currentOrder = this.pos.get('selectedOrder'); + var paidTotal = currentOrder.getPaidTotal(); + var dueTotal = currentOrder.getTotalTaxIncluded(); + var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0; + if (change) { + change_rounded = change.toFixed(2); + this.pos.prepare_text_customer_display('update_payment', {'change': change_rounded}); + } + return res; + }; + var _super_closePOS_ = module.PosWidget.prototype.close; module.PosWidget.prototype.close = function(){ this.pos.prepare_text_customer_display('closePOS', {}); From bf8560bc2c9c81668d35f133bf27cacdfcaf6525 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 24 Oct 2014 14:24:31 +0200 Subject: [PATCH 10/48] FIX bugs Remove paiment method from LCD message Add missing POT file Update FR translation --- pos_customer_display/i18n/fr.po | 62 +++++------- .../i18n/pos_customer_display.pot | 96 +++++++++++++++++++ .../static/src/js/customer_display.js | 23 ++--- 3 files changed, 133 insertions(+), 48 deletions(-) create mode 100644 pos_customer_display/i18n/pos_customer_display.pot diff --git a/pos_customer_display/i18n/fr.po b/pos_customer_display/i18n/fr.po index 9fa4cc09..a74c7923 100644 --- a/pos_customer_display/i18n/fr.po +++ b/pos_customer_display/i18n/fr.po @@ -1,14 +1,14 @@ -# Translation of OpenERP Server. +# Translation of Odoo Server. # This file contains the translation of the following modules: # * pos_customer_display # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 9.0alpha1\n" +"Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-07-21 10:50+0000\n" -"PO-Revision-Date: 2014-07-21 10:50+0000\n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2014-10-24 12:05+0000\n" +"PO-Revision-Date: 2014-10-24 12:05+0000\n" +"Last-Translator: Alexis de Lattre \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -17,14 +17,14 @@ msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:72 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:47 #, python-format -msgid "***" -msgstr "***" +msgid "Cancel Payment" +msgstr "Paiement annulé" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:161 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:157 #: field:pos.config,iface_customer_display:0 #, python-format msgid "Customer display" @@ -32,27 +32,20 @@ msgstr "Afficheur client" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:32 -#, python-format -msgid "Delete item" -msgstr "Suppression article" - -#. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:47 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:31 #, python-format -msgid "Delete payment" -msgstr "Suppression paiement" +msgid "Delete Item" +msgstr "Article supprimé" #. module: pos_customer_display #: help:pos.config,iface_customer_display:0 msgid "Display data on the customer display" -msgstr "Afficher les info sur l'afficheur client" +msgstr "Utiliser l'afficheur client" #. module: pos_customer_display #: help:pos.config,customer_display_line_length:0 msgid "Length of the LEDs lines of the customer display" -msgstr "Longueur des lignes de l'afficheur client, nombre de caractères" +msgstr "Longueur des lignes de l'afficheur client: nombre de caractères" #. module: pos_customer_display #: field:pos.config,customer_display_line_length:0 @@ -61,14 +54,14 @@ msgstr "Longueur des lignes" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:67 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:60 #, python-format -msgid "Next customer..." -msgstr "Client suivant..." +msgid "Next Customer" +msgstr "Client suivant" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:164 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:160 #, python-format msgid "Offline" msgstr "Hors ligne" @@ -77,32 +70,27 @@ msgstr "Hors ligne" #. openerp-web #: code:addons/pos_customer_display/static/src/js/customer_display.js:40 #, python-format -msgid "Payment :" +msgid "Payment:" msgstr "Paiement :" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:71 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:66 #, python-format -msgid "Point of sale closed" +msgid "Point of Sale Closed" msgstr "Caisse fermée" #. module: pos_customer_display #. openerp-web #: code:addons/pos_customer_display/static/src/js/customer_display.js:39 #, python-format -msgid "TOTAL : " +msgid "TOTAL: " msgstr "TOTAL : " #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:62 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:54 #, python-format -msgid "YOUR CHANGE :" -msgstr "VOTRE MONNAIE :" - -#. module: pos_customer_display -#: model:ir.model,name:pos_customer_display.model_pos_config -msgid "pos.config" -msgstr "pos.config" +msgid "Your Change:" +msgstr "Monnaie à rendre :" diff --git a/pos_customer_display/i18n/pos_customer_display.pot b/pos_customer_display/i18n/pos_customer_display.pot new file mode 100644 index 00000000..691f1480 --- /dev/null +++ b/pos_customer_display/i18n/pos_customer_display.pot @@ -0,0 +1,96 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_customer_display +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-24 12:04+0000\n" +"PO-Revision-Date: 2014-10-24 12:04+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: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:47 +#, python-format +msgid "Cancel Payment" +msgstr "" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:157 +#: field:pos.config,iface_customer_display:0 +#, python-format +msgid "Customer display" +msgstr "" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:31 +#, python-format +msgid "Delete Item" +msgstr "" + +#. module: pos_customer_display +#: help:pos.config,iface_customer_display:0 +msgid "Display data on the customer display" +msgstr "" + +#. module: pos_customer_display +#: help:pos.config,customer_display_line_length:0 +msgid "Length of the LEDs lines of the customer display" +msgstr "" + +#. module: pos_customer_display +#: field:pos.config,customer_display_line_length:0 +msgid "Line length" +msgstr "" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:60 +#, python-format +msgid "Next Customer" +msgstr "" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:160 +#, python-format +msgid "Offline" +msgstr "" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:40 +#, python-format +msgid "Payment:" +msgstr "" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:66 +#, python-format +msgid "Point of Sale Closed" +msgstr "" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:39 +#, python-format +msgid "TOTAL: " +msgstr "" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:54 +#, python-format +msgid "Your Change:" +msgstr "" + diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index aa58ed7e..55c453fe 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -28,23 +28,22 @@ openerp.pos_customer_display = function(instance){ // first click on the backspace button set the amount to 0 => we can't precise the deleted qunatity and price var line = data['line']; var lines_to_send = new Array( - this.proxy.align_center(_t("Delete item"), line_length), + this.proxy.align_center(_t("Delete Item"), line_length), this.proxy.align_center(line.get_product().name, line_length) ); } else if (type == 'addPaymentline') { - var cashregister = data['cashregister']; var total = this.get('selectedOrder').getTotalTaxIncluded().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.align_left(_t("TOTAL: "), line_length - 1 - total.length) + ' ' + total, - this.proxy.align_left(_t("Payment:"), line_length - 1 - cashregister.journal_id[1].length) + ' ' + cashregister.journal_id[1] + this.proxy.align_left(_t("TOTAL: "), line_length), + this.proxy.align_right(total, line_length) ); } else if (type == 'removePaymentline') { var line = data['line']; var amount = line.get_amount().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.align_center(_t("Delete payment"), line_length), + this.proxy.align_center(_t("Cancel Payment"), line_length), this.proxy.align_left(line.cashregister.journal_id[1] , line_length - 1 - amount.length) + ' ' + amount ); @@ -57,14 +56,14 @@ openerp.pos_customer_display = function(instance){ } else if (type == 'pushOrder') { var lines_to_send = new Array( - this.proxy.align_center(_t("Next customer"), line_length), - '' + this.proxy.align_center(_t("Next Customer"), line_length), + this.proxy.align_left(' ', line_length) ); } else if (type = 'closePOS') { var lines_to_send = new Array( - this.proxy.align_center(_t("Point of sale closed"), line_length), - '' + this.proxy.align_center(_t("Point of Sale Closed"), line_length), + this.proxy.align_left(' ', line_length) ); } else { console.warn('Unknown message type'); @@ -82,13 +81,13 @@ openerp.pos_customer_display = function(instance){ send_text_customer_display: function(data, line_length){ //FIXME : this function is call twice. The first time, it is not called by prepare_text_customer_display : WHY ? if (_.isEmpty(data) || data.length != 2 || data[0].length != line_length || data[1].length != line_length){ - console.warn("Bad Data argument. Data = " + data); - console.warn('Line_length = ' + line_length); + console.warn("send_text_customer_display: Bad Data argument. Data=" + data + ' line_length=' + line_length); } else { // alert(JSON.stringify(data)); return this.message('send_text_customer_display', {'text_to_display' : JSON.stringify(data)}); } }, + align_left: function(string, length){ if (string) { if (string.length > length) @@ -104,6 +103,7 @@ openerp.pos_customer_display = function(instance){ } return string; }, + align_right: function(string, length){ if (string) { if (string.length > length) @@ -119,6 +119,7 @@ openerp.pos_customer_display = function(instance){ } return string; }, + align_center: function(string, length){ if (string) { if (string.length > length) From 564bd502917366ed41e0ec823b81d2b145bf2bb2 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 24 Oct 2014 15:47:00 +0200 Subject: [PATCH 11/48] Add message on POS open Remove code that was not working FIX bug in removeOrderLine Update translation --- pos_customer_display/i18n/fr.po | 38 +++++-------- .../i18n/pos_customer_display.pot | 32 ++++------- .../static/src/js/customer_display.js | 56 +++++++++---------- 3 files changed, 53 insertions(+), 73 deletions(-) diff --git a/pos_customer_display/i18n/fr.po b/pos_customer_display/i18n/fr.po index a74c7923..d5332a88 100644 --- a/pos_customer_display/i18n/fr.po +++ b/pos_customer_display/i18n/fr.po @@ -6,9 +6,9 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-24 12:05+0000\n" -"PO-Revision-Date: 2014-10-24 12:05+0000\n" -"Last-Translator: Alexis de Lattre \n" +"POT-Creation-Date: 2014-10-24 13:45+0000\n" +"PO-Revision-Date: 2014-10-24 13:45+0000\n" +"Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -17,22 +17,19 @@ msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:47 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:56 #, python-format msgid "Cancel Payment" msgstr "Paiement annulé" #. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:157 #: field:pos.config,iface_customer_display:0 -#, python-format msgid "Customer display" msgstr "Afficheur client" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:31 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:41 #, python-format msgid "Delete Item" msgstr "Article supprimé" @@ -54,42 +51,35 @@ msgstr "Longueur des lignes" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:60 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:69 #, python-format msgid "Next Customer" msgstr "Client suivant" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:160 -#, python-format -msgid "Offline" -msgstr "Hors ligne" - -#. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:40 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:81 #, python-format -msgid "Payment:" -msgstr "Paiement :" +msgid "Point of Sale Closed" +msgstr "Caisse fermée" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:66 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:75 #, python-format -msgid "Point of Sale Closed" -msgstr "Caisse fermée" +msgid "Point of Sale Open" +msgstr "Caisse ouverte" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:39 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:48 #, python-format msgid "TOTAL: " msgstr "TOTAL : " #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:54 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:63 #, python-format msgid "Your Change:" msgstr "Monnaie à rendre :" diff --git a/pos_customer_display/i18n/pos_customer_display.pot b/pos_customer_display/i18n/pos_customer_display.pot index 691f1480..fa783681 100644 --- a/pos_customer_display/i18n/pos_customer_display.pot +++ b/pos_customer_display/i18n/pos_customer_display.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-24 12:04+0000\n" -"PO-Revision-Date: 2014-10-24 12:04+0000\n" +"POT-Creation-Date: 2014-10-24 13:44+0000\n" +"PO-Revision-Date: 2014-10-24 13:44+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -17,22 +17,19 @@ msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:47 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:56 #, python-format msgid "Cancel Payment" msgstr "" #. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:157 #: field:pos.config,iface_customer_display:0 -#, python-format msgid "Customer display" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:31 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:41 #, python-format msgid "Delete Item" msgstr "" @@ -54,42 +51,35 @@ msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:60 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:69 #, python-format msgid "Next Customer" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:160 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:81 #, python-format -msgid "Offline" -msgstr "" - -#. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:40 -#, python-format -msgid "Payment:" +msgid "Point of Sale Closed" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:66 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:75 #, python-format -msgid "Point of Sale Closed" +msgid "Point of Sale Open" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:39 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:48 #, python-format msgid "TOTAL: " msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:54 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:63 #, python-format msgid "Your Change:" msgstr "" diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index 55c453fe..fd404ebb 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -1,3 +1,13 @@ +/* + POS Customer display module for Odoo + Copyright (C) 2014 Aurélien DUMAINE + Copyright (C) 2014 Barroux Abbey (www.barroux.org) + @author: Aurélien DUMAINE + @author: Alexis de Lattre + @author: Father Odilon (Barroux Abbey) + The licence is in the file __openerp__.py +*/ + openerp.pos_customer_display = function(instance){ module = instance.point_of_sale; @@ -28,8 +38,8 @@ openerp.pos_customer_display = function(instance){ // first click on the backspace button set the amount to 0 => we can't precise the deleted qunatity and price var line = data['line']; var lines_to_send = new Array( - this.proxy.align_center(_t("Delete Item"), line_length), - this.proxy.align_center(line.get_product().name, line_length) + this.proxy.align_left(_t("Delete Item"), line_length), + this.proxy.align_right(line.get_product().display_name, line_length) ); } else if (type == 'addPaymentline') { @@ -43,8 +53,8 @@ openerp.pos_customer_display = function(instance){ var line = data['line']; var amount = line.get_amount().toFixed(currency_rounding); var lines_to_send = new Array( - this.proxy.align_center(_t("Cancel Payment"), line_length), - this.proxy.align_left(line.cashregister.journal_id[1] , line_length - 1 - amount.length) + ' ' + amount + this.proxy.align_left(_t("Cancel Payment"), line_length), + this.proxy.align_right(line.cashregister.journal_id[1] , line_length - 1 - amount.length) + ' ' + amount ); } else if (type == 'update_payment') { @@ -60,6 +70,12 @@ openerp.pos_customer_display = function(instance){ this.proxy.align_left(' ', line_length) ); + } else if (type == 'openPOS') { + var lines_to_send = new Array( + this.proxy.align_center(_t("Point of Sale Open"), line_length), + this.proxy.align_left(' ', line_length) + ); + } else if (type = 'closePOS') { var lines_to_send = new Array( this.proxy.align_center(_t("Point of Sale Closed"), line_length), @@ -70,8 +86,8 @@ openerp.pos_customer_display = function(instance){ return; } -// alert("In prepare_text_customer_display " + line_length); this.proxy.send_text_customer_display(lines_to_send, line_length); + //console.log('prepare_text_customer_display type=' + type + ' | l1=' + lines_to_send[0] + ' | l2=' + lines_to_send[1]); }, }); @@ -140,29 +156,6 @@ openerp.pos_customer_display = function(instance){ }, }); - - //FIXME : nothing happen on customer display deconnection - var _super_setSmartStatus_ = module.ProxyStatusWidget.prototype.set_smart_status; - module.ProxyStatusWidget.prototype.set_smart_status = function(status){ - _super_setSmartStatus_.call(this, status); - if (status.status === 'connected') { - var warning = false; - var msg = ''; - if (this.pos.config.iface_customer_display) { - var customer_display = status.drivers.customer_display ? status.drivers.customer_display.status : false; - if (customer_display != 'connected' && customer_display != 'connecting') { - warning = true; - msg = msg ? msg + ' & ' : msg; - msg += _t('Customer display'); - } - } - msg = msg ? msg + ' ' + _t('Offline') : msg; - this.set_status(warning ? 'warning' : 'connected', msg); - } else { - this.set_status(status.status, ''); - } - }; - var _super_addProduct_ = module.Order.prototype.addProduct; module.Order.prototype.addProduct = function(product, options){ res = _super_addProduct_.call(this, product, options); @@ -226,4 +219,11 @@ openerp.pos_customer_display = function(instance){ return _super_closePOS_.call(this); }; + var _super_proxy_start_ = module.ProxyStatusWidget.prototype.start; + module.ProxyStatusWidget.prototype.start = function(){ + res = _super_proxy_start_.call(this); + this.pos.prepare_text_customer_display('openPOS', {}); + return res; + }; + }; From b7a31a863619c88710c33564f4a039bd4c884176 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 17 Nov 2014 13:09:21 +0100 Subject: [PATCH 12/48] Add Spanish translation by Alejandro Amador (thanks for your contribution !) Move CSS definition from pos_payment_terminal_view.xml to pos_payment_terminal.xml Small cleanups --- pos_customer_display/i18n/es.po | 87 +++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 pos_customer_display/i18n/es.po diff --git a/pos_customer_display/i18n/es.po b/pos_customer_display/i18n/es.po new file mode 100644 index 00000000..19a40b26 --- /dev/null +++ b/pos_customer_display/i18n/es.po @@ -0,0 +1,87 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_customer_display +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-11-17 11:00+0000\n" +"PO-Revision-Date: 2014-11-17 12:03+0100\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"Language: es\n" +"X-Generator: Poedit 1.6.10\n" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:56 +#, python-format +msgid "Cancel Payment" +msgstr "Pago Cancelado" + +#. module: pos_customer_display +#: field:pos.config,iface_customer_display:0 +msgid "Customer display" +msgstr "Visor cliente" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:41 +#, python-format +msgid "Delete Item" +msgstr "Producto Eliminado" + +#. module: pos_customer_display +#: help:pos.config,iface_customer_display:0 +msgid "Display data on the customer display" +msgstr "Mostrar información en el visor de cliente" + +#. module: pos_customer_display +#: help:pos.config,customer_display_line_length:0 +msgid "Length of the LEDs lines of the customer display" +msgstr "Longitud de las líneas LED en el visor de cliente" + +#. module: pos_customer_display +#: field:pos.config,customer_display_line_length:0 +msgid "Line length" +msgstr "Longitud de línea " + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:69 +#, python-format +msgid "Next Customer" +msgstr "Próximo Cliente" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:81 +#, python-format +msgid "Point of Sale Closed" +msgstr "Punto de Venta Cerrado" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:75 +#, python-format +msgid "Point of Sale Open" +msgstr "Punto de Venta Abierto" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:48 +#, python-format +msgid "TOTAL: " +msgstr "TOTAL: " + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:63 +#, python-format +msgid "Your Change:" +msgstr "Su Cambio:" From 5fab8d8d8c22bdbd35e44db72512f9dcc33d50c5 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 18 Nov 2014 18:12:51 +0100 Subject: [PATCH 13/48] Update ES translation by Alejandro Amador --- pos_customer_display/i18n/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pos_customer_display/i18n/es.po b/pos_customer_display/i18n/es.po index 19a40b26..fcb58692 100644 --- a/pos_customer_display/i18n/es.po +++ b/pos_customer_display/i18n/es.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-11-17 11:00+0000\n" -"PO-Revision-Date: 2014-11-17 12:03+0100\n" +"PO-Revision-Date: 2014-11-17 18:33+0100\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -63,14 +63,14 @@ msgstr "Próximo Cliente" #: code:addons/pos_customer_display/static/src/js/customer_display.js:81 #, python-format msgid "Point of Sale Closed" -msgstr "Punto de Venta Cerrado" +msgstr "Punto Venta Cerrado" #. module: pos_customer_display #. openerp-web #: code:addons/pos_customer_display/static/src/js/customer_display.js:75 #, python-format msgid "Point of Sale Open" -msgstr "Punto de Venta Abierto" +msgstr "Punto Venta Abierto" #. module: pos_customer_display #. openerp-web From c8324aa0a9e442a151d295f5286ab877b2e4426f Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 6 Jan 2015 23:26:30 +0100 Subject: [PATCH 14/48] PEP8 --- pos_customer_display/__openerp__.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/pos_customer_display/__openerp__.py b/pos_customer_display/__openerp__.py index 3f0a7c1e..584f3059 100644 --- a/pos_customer_display/__openerp__.py +++ b/pos_customer_display/__openerp__.py @@ -29,18 +29,29 @@ POS Customer Display ==================== -This module adds support for Customer Display in the Point of Sale. This module is designed to be installed on the *main Odoo server*. On the *POSbox*, you should install the module *hw_customer_display*. +This module adds support for Customer Display in the Point of Sale. This +module is designed to be installed on the *main Odoo server*. On the +*POSbox*, you should install the module *hw_customer_display*. -The number of rows and cols of the Customer Display (usually 2 x 20) should be configured on the main Odoo server, in the menu Point of Sale > Configuration > Point of Sales. +The number of rows and cols of the Customer Display (usually 2 x 20) +should be configured on the main Odoo server, in the menu Point of Sale +> Configuration > Point of Sales. -It has been tested with a Bixolon BCD-1100 (http://www.bixolon.com/html/en/product/product_detail.xhtml?prod_id=61), but should support most serial and USB-serial LCD displays out-of-the-box, cf the module *hw_customer_display* for more info. +It has been tested with a Bixolon BCD-1100 +(http://www.bixolon.com/html/en/product/product_detail.xhtml?prod_id=61), +but should support most serial and USB-serial LCD displays +out-of-the-box, cf the module *hw_customer_display* for more info. -This module has been developped during a POS code sprint at Akretion France from July 7th to July 10th 2014. This module is part of the POS project of the Odoo Community Association http://odoo-community.org/. You are invited to become a member and/or get involved in the Association ! +This module has been developped during a POS code sprint at Akretion +France from July 7th to July 10th 2014. This module is part of the POS +project of the Odoo Community Association http://odoo-community.org/. +You are invited to become a member and/or get involved in the +Association ! """, 'author': 'Aurélien DUMAINE', 'depends': ['point_of_sale'], - 'data' : [ - 'pos_customer_display.xml', - 'customer_display_view.xml', - ], + 'data': [ + 'pos_customer_display.xml', + 'customer_display_view.xml', + ], } From 50edb53b70f44e759891471024d116881a804a08 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 6 Feb 2015 15:30:44 +0100 Subject: [PATCH 15/48] Add license key in __openerp__.py --- pos_customer_display/__openerp__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pos_customer_display/__openerp__.py b/pos_customer_display/__openerp__.py index 584f3059..ebeaa555 100644 --- a/pos_customer_display/__openerp__.py +++ b/pos_customer_display/__openerp__.py @@ -49,6 +49,7 @@ You are invited to become a member and/or get involved in the Association ! """, 'author': 'Aurélien DUMAINE', + 'license': 'AGPL-3', 'depends': ['point_of_sale'], 'data': [ 'pos_customer_display.xml', From 01bb345459c12ea652c9c07302605308685c09db Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Mar 2015 15:37:13 +0100 Subject: [PATCH 16/48] Add OCA as author of OCA addons In order to get visibility on https://www.odoo.com/apps the OCA board has decided to add the OCA as author of all the addons maintained as part of the association. --- pos_customer_display/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pos_customer_display/__openerp__.py b/pos_customer_display/__openerp__.py index ebeaa555..985ef9e2 100644 --- a/pos_customer_display/__openerp__.py +++ b/pos_customer_display/__openerp__.py @@ -48,7 +48,7 @@ project of the Odoo Community Association http://odoo-community.org/. You are invited to become a member and/or get involved in the Association ! """, - 'author': 'Aurélien DUMAINE', + 'author': "Aurélien DUMAINE,Odoo Community Association (OCA)", 'license': 'AGPL-3', 'depends': ['point_of_sale'], 'data': [ From a08d6701e6460ca29b99d508a41a29aa599f1a75 Mon Sep 17 00:00:00 2001 From: Jos De Graeve Date: Mon, 23 Mar 2015 19:01:14 +0100 Subject: [PATCH 17/48] Added dutch translation --- pos_customer_display/i18n/nl.po | 87 +++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 pos_customer_display/i18n/nl.po diff --git a/pos_customer_display/i18n/nl.po b/pos_customer_display/i18n/nl.po new file mode 100644 index 00000000..6bf52461 --- /dev/null +++ b/pos_customer_display/i18n/nl.po @@ -0,0 +1,87 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_customer_display +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-24 13:44+0000\n" +"PO-Revision-Date: 2015-03-23 19:00+0100\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.7.5\n" +"Language: nl\n" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:56 +#, python-format +msgid "Cancel Payment" +msgstr "Annuleren Betaling" + +#. module: pos_customer_display +#: field:pos.config,iface_customer_display:0 +msgid "Customer display" +msgstr "Klant Scherm" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:41 +#, python-format +msgid "Delete Item" +msgstr "Verwijderen Item" + +#. module: pos_customer_display +#: help:pos.config,iface_customer_display:0 +msgid "Display data on the customer display" +msgstr "Weergeven gegevens op het klant scherm" + +#. module: pos_customer_display +#: help:pos.config,customer_display_line_length:0 +msgid "Length of the LEDs lines of the customer display" +msgstr "Lengte van de LED lijnen van het klant scherm" + +#. module: pos_customer_display +#: field:pos.config,customer_display_line_length:0 +msgid "Line length" +msgstr "Lijn lengte" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:69 +#, python-format +msgid "Next Customer" +msgstr "Volgende Klant" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:81 +#, python-format +msgid "Point of Sale Closed" +msgstr "Kassa Gesloten" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:75 +#, python-format +msgid "Point of Sale Open" +msgstr "Kassa Open" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:48 +#, python-format +msgid "TOTAL: " +msgstr "TOTAAL:" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:63 +#, python-format +msgid "Your Change:" +msgstr "Wisselgeld:" From 7f7021937bf92b525590cf07cc7f0e5865651b36 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Apr 2015 21:26:23 +0200 Subject: [PATCH 18/48] [IMP] Add German Language --- pos_customer_display/i18n/de.po | 86 +++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 pos_customer_display/i18n/de.po diff --git a/pos_customer_display/i18n/de.po b/pos_customer_display/i18n/de.po new file mode 100644 index 00000000..91b495c1 --- /dev/null +++ b/pos_customer_display/i18n/de.po @@ -0,0 +1,86 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_customer_display +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-24 13:44+0000\n" +"PO-Revision-Date: 2014-10-24 13:44+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: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:56 +#, python-format +msgid "Cancel Payment" +msgstr "Zahlung stornieren" + +#. module: pos_customer_display +#: field:pos.config,iface_customer_display:0 +msgid "Customer display" +msgstr "Kunden-Display" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:41 +#, python-format +msgid "Delete Item" +msgstr "Artikel löschen" + +#. module: pos_customer_display +#: help:pos.config,iface_customer_display:0 +msgid "Display data on the customer display" +msgstr "Daten auf dem Kunden-Display anzeigen" + +#. module: pos_customer_display +#: help:pos.config,customer_display_line_length:0 +msgid "Length of the LEDs lines of the customer display" +msgstr "Länge der LED-Zeilen auf dem Kunden-Display" + +#. module: pos_customer_display +#: field:pos.config,customer_display_line_length:0 +msgid "Line length" +msgstr "Zeilenlänge" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:69 +#, python-format +msgid "Next Customer" +msgstr "Nächster Kunde" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:81 +#, python-format +msgid "Point of Sale Closed" +msgstr "Kasse geschlossen" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:75 +#, python-format +msgid "Point of Sale Open" +msgstr "Kasse geöffnet" + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:48 +#, python-format +msgid "TOTAL: " +msgstr "SUMME: " + +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/js/customer_display.js:63 +#, python-format +msgid "Your Change:" +msgstr "Rueckgeld:" + From 0265c0de5f4b96ce71cecade874f7493acd196f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 13 May 2015 22:33:32 +0200 Subject: [PATCH 19/48] [FIX] correcting some chars --- pos_customer_display/i18n/de.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pos_customer_display/i18n/de.po b/pos_customer_display/i18n/de.po index 91b495c1..486c85ab 100644 --- a/pos_customer_display/i18n/de.po +++ b/pos_customer_display/i18n/de.po @@ -32,7 +32,7 @@ msgstr "Kunden-Display" #: code:addons/pos_customer_display/static/src/js/customer_display.js:41 #, python-format msgid "Delete Item" -msgstr "Artikel löschen" +msgstr "Artikel loeschen" #. module: pos_customer_display #: help:pos.config,iface_customer_display:0 @@ -54,7 +54,7 @@ msgstr "Zeilenlänge" #: code:addons/pos_customer_display/static/src/js/customer_display.js:69 #, python-format msgid "Next Customer" -msgstr "Nächster Kunde" +msgstr "Naechster Kunde" #. module: pos_customer_display #. openerp-web @@ -68,7 +68,7 @@ msgstr "Kasse geschlossen" #: code:addons/pos_customer_display/static/src/js/customer_display.js:75 #, python-format msgid "Point of Sale Open" -msgstr "Kasse geöffnet" +msgstr "Kasse geoeffnet" #. module: pos_customer_display #. openerp-web From eae609617a9598497dc3bab6fabe19cc1de62401 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 17 May 2015 01:51:59 +0200 Subject: [PATCH 20/48] pos_customer_display: Add button "Display Total to Customer" and port to new API pos_payment_terminal: code cleanup --- pos_customer_display/__openerp__.py | 4 ++- pos_customer_display/i18n/fr.po | 31 ++++++++++++------- .../i18n/pos_customer_display.pot | 29 ++++++++++------- pos_customer_display/pos_customer_display.py | 28 ++++++----------- pos_customer_display/pos_customer_display.xml | 5 +++ .../pos_customer_display_demo.xml | 13 ++++++++ .../static/src/css/pos_customer_display.css | 15 +++++++++ .../static/src/js/customer_display.js | 20 ++++++++++++ pos_customer_display/static/src/xml/pos.xml | 14 +++++++++ 9 files changed, 116 insertions(+), 43 deletions(-) create mode 100644 pos_customer_display/pos_customer_display_demo.xml create mode 100644 pos_customer_display/static/src/css/pos_customer_display.css create mode 100644 pos_customer_display/static/src/xml/pos.xml diff --git a/pos_customer_display/__openerp__.py b/pos_customer_display/__openerp__.py index 985ef9e2..0b1072c7 100644 --- a/pos_customer_display/__openerp__.py +++ b/pos_customer_display/__openerp__.py @@ -48,11 +48,13 @@ project of the Odoo Community Association http://odoo-community.org/. You are invited to become a member and/or get involved in the Association ! """, - 'author': "Aurélien DUMAINE,Odoo Community Association (OCA)", + 'author': "Aurélien DUMAINE,Akretion,Odoo Community Association (OCA)", 'license': 'AGPL-3', 'depends': ['point_of_sale'], 'data': [ 'pos_customer_display.xml', 'customer_display_view.xml', ], + 'qweb': ['static/src/xml/pos.xml'], + 'demo': ['pos_customer_display_demo.xml'], } diff --git a/pos_customer_display/i18n/fr.po b/pos_customer_display/i18n/fr.po index d5332a88..06daa1f8 100644 --- a/pos_customer_display/i18n/fr.po +++ b/pos_customer_display/i18n/fr.po @@ -6,9 +6,9 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-24 13:45+0000\n" -"PO-Revision-Date: 2014-10-24 13:45+0000\n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2015-05-16 23:24+0000\n" +"PO-Revision-Date: 2015-05-16 23:24+0000\n" +"Last-Translator: Alexis de Lattre \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -17,23 +17,30 @@ msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:56 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:58 #, python-format msgid "Cancel Payment" msgstr "Paiement annulé" #. module: pos_customer_display #: field:pos.config,iface_customer_display:0 -msgid "Customer display" +msgid "Customer Display" msgstr "Afficheur client" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:41 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:42 #, python-format msgid "Delete Item" msgstr "Article supprimé" +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/xml/pos.xml:7 +#, python-format +msgid "Display Total to Customer" +msgstr "Afficher le total au client" + #. module: pos_customer_display #: help:pos.config,iface_customer_display:0 msgid "Display data on the customer display" @@ -46,40 +53,40 @@ msgstr "Longueur des lignes de l'afficheur client: nombre de caractères" #. module: pos_customer_display #: field:pos.config,customer_display_line_length:0 -msgid "Line length" +msgid "Line Length" msgstr "Longueur des lignes" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:69 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:71 #, python-format msgid "Next Customer" msgstr "Client suivant" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:81 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:83 #, python-format msgid "Point of Sale Closed" msgstr "Caisse fermée" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:75 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:77 #, python-format msgid "Point of Sale Open" msgstr "Caisse ouverte" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:48 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:50 #, python-format msgid "TOTAL: " msgstr "TOTAL : " #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:63 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:65 #, python-format msgid "Your Change:" msgstr "Monnaie à rendre :" diff --git a/pos_customer_display/i18n/pos_customer_display.pot b/pos_customer_display/i18n/pos_customer_display.pot index fa783681..6ff26e33 100644 --- a/pos_customer_display/i18n/pos_customer_display.pot +++ b/pos_customer_display/i18n/pos_customer_display.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-24 13:44+0000\n" -"PO-Revision-Date: 2014-10-24 13:44+0000\n" +"POT-Creation-Date: 2015-05-16 23:24+0000\n" +"PO-Revision-Date: 2015-05-16 23:24+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -17,23 +17,30 @@ msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:56 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:58 #, python-format msgid "Cancel Payment" msgstr "" #. module: pos_customer_display #: field:pos.config,iface_customer_display:0 -msgid "Customer display" +msgid "Customer Display" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:41 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:42 #, python-format msgid "Delete Item" msgstr "" +#. module: pos_customer_display +#. openerp-web +#: code:addons/pos_customer_display/static/src/xml/pos.xml:7 +#, python-format +msgid "Display Total to Customer" +msgstr "" + #. module: pos_customer_display #: help:pos.config,iface_customer_display:0 msgid "Display data on the customer display" @@ -46,40 +53,40 @@ msgstr "" #. module: pos_customer_display #: field:pos.config,customer_display_line_length:0 -msgid "Line length" +msgid "Line Length" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:69 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:71 #, python-format msgid "Next Customer" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:81 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:83 #, python-format msgid "Point of Sale Closed" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:75 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:77 #, python-format msgid "Point of Sale Open" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:48 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:50 #, python-format msgid "TOTAL: " msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:63 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:65 #, python-format msgid "Your Change:" msgstr "" diff --git a/pos_customer_display/pos_customer_display.py b/pos_customer_display/pos_customer_display.py index d2bcb43e..060e7881 100644 --- a/pos_customer_display/pos_customer_display.py +++ b/pos_customer_display/pos_customer_display.py @@ -3,6 +3,8 @@ # # POS Customer Display module for Odoo # Copyright (C) 2014 Aurélien DUMAINE +# Copyright (C) 2015 Akretion (www.akretion.com) +# @author: Alexis de Lattre # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -19,26 +21,14 @@ # ############################################################################## -import logging -from openerp.osv import fields, orm +from openerp import models, fields -_logger = logging.getLogger(__name__) - -class pos_config(orm.Model): - _name = 'pos.config' +class PosConfig(models.Model): _inherit = 'pos.config' - _columns = { - 'iface_customer_display': fields.boolean( - 'Customer display', help="Display data on the customer display"), - 'customer_display_line_length': fields.integer( - 'Line length', - help="Length of the LEDs lines of the customer display"), - } - - _defaults = { - 'customer_display_line_length': 20, - } - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + iface_customer_display = fields.Boolean( + string='Customer Display', help="Display data on the customer display") + customer_display_line_length = fields.Integer( + string='Line Length', default=20, + help="Length of the LEDs lines of the customer display") diff --git a/pos_customer_display/pos_customer_display.xml b/pos_customer_display/pos_customer_display.xml index 3aaa679e..c559baa3 100644 --- a/pos_customer_display/pos_customer_display.xml +++ b/pos_customer_display/pos_customer_display.xml @@ -6,5 +6,10 @@ + diff --git a/pos_customer_display/pos_customer_display_demo.xml b/pos_customer_display/pos_customer_display_demo.xml new file mode 100644 index 00000000..d2f4421b --- /dev/null +++ b/pos_customer_display/pos_customer_display_demo.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/pos_customer_display/static/src/css/pos_customer_display.css b/pos_customer_display/static/src/css/pos_customer_display.css new file mode 100644 index 00000000..f9bf6611 --- /dev/null +++ b/pos_customer_display/static/src/css/pos_customer_display.css @@ -0,0 +1,15 @@ +.pos .show-total-to-customer { + width: 220px; + height: 40px; + font-size: 16px; + cursor: pointer; + text-align: center; + box-sizing: border-box; +} + +.pos .show-total-to-customer-div { + float: left; + margin-right: 15px; + margin-left: 15px; + margin-top: 20px; +} diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index fd404ebb..7f6723c8 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -226,4 +226,24 @@ openerp.pos_customer_display = function(instance){ return res; }; + /* Handle Button "Display Total to Customer" */ + var _super_OrderWidget_init_ = module.OrderWidget.prototype.init; + module.OrderWidget.prototype.init = function(parent, options){ + _super_OrderWidget_init_.call(this, parent, options); + var self = this; + this.prepare_text_customer_display = function(event){ + self.pos.prepare_text_customer_display('addPaymentline', {}); + event.stopPropagation(); + }; + }; + + var _super_update_summary_ = module.OrderWidget.prototype.update_summary; + module.OrderWidget.prototype.update_summary = function(){ + _super_update_summary_.call(this); + if (this.pos.config.iface_customer_display){ + this.el.querySelector('.show-total-to-customer') + .addEventListener('click', this.prepare_text_customer_display); + } + }; + }; diff --git a/pos_customer_display/static/src/xml/pos.xml b/pos_customer_display/static/src/xml/pos.xml new file mode 100644 index 00000000..0f98e18a --- /dev/null +++ b/pos_customer_display/static/src/xml/pos.xml @@ -0,0 +1,14 @@ + + + + + +
+ +
+
+
+
+
From 40f2edc759e63ae225ebde2d6dd648512dae95df Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 12 Jun 2015 12:28:36 +0200 Subject: [PATCH 21/48] Cleaner inheritance implementation in pos_customer_display Better debug logs in hw_* modules for LCD and Telium --- .../static/src/js/customer_display.js | 85 ++++++++++--------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index 7f6723c8..9f6afed4 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -199,51 +199,52 @@ openerp.pos_customer_display = function(instance){ return res; }; - var _super_update_payment_summary_ = module.PaymentScreenWidget.prototype.update_payment_summary; - module.PaymentScreenWidget.prototype.update_payment_summary = function(){ - res = _super_update_payment_summary_.call(this); - var currentOrder = this.pos.get('selectedOrder'); - var paidTotal = currentOrder.getPaidTotal(); - var dueTotal = currentOrder.getTotalTaxIncluded(); - var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0; - if (change) { - change_rounded = change.toFixed(2); - this.pos.prepare_text_customer_display('update_payment', {'change': change_rounded}); - } - return res; - }; + module.PaymentScreenWidget.include({ + update_payment_summary: function(){ + res = this._super(); + var currentOrder = this.pos.get('selectedOrder'); + var paidTotal = currentOrder.getPaidTotal(); + var dueTotal = currentOrder.getTotalTaxIncluded(); + var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0; + if (change) { + change_rounded = change.toFixed(2); + this.pos.prepare_text_customer_display('update_payment', {'change': change_rounded}); + } + return res; + }, + }); - var _super_closePOS_ = module.PosWidget.prototype.close; - module.PosWidget.prototype.close = function(){ - this.pos.prepare_text_customer_display('closePOS', {}); - return _super_closePOS_.call(this); - }; + module.PosWidget.include({ + close: function(){ + this._super(); + this.pos.prepare_text_customer_display('closePOS', {}); + }, + }); - var _super_proxy_start_ = module.ProxyStatusWidget.prototype.start; - module.ProxyStatusWidget.prototype.start = function(){ - res = _super_proxy_start_.call(this); - this.pos.prepare_text_customer_display('openPOS', {}); - return res; - }; + module.ProxyStatusWidget.include({ + start: function(){ + this._super(); + this.pos.prepare_text_customer_display('openPOS', {}); + }, + }); /* Handle Button "Display Total to Customer" */ - var _super_OrderWidget_init_ = module.OrderWidget.prototype.init; - module.OrderWidget.prototype.init = function(parent, options){ - _super_OrderWidget_init_.call(this, parent, options); - var self = this; - this.prepare_text_customer_display = function(event){ - self.pos.prepare_text_customer_display('addPaymentline', {}); - event.stopPropagation(); - }; - }; - - var _super_update_summary_ = module.OrderWidget.prototype.update_summary; - module.OrderWidget.prototype.update_summary = function(){ - _super_update_summary_.call(this); - if (this.pos.config.iface_customer_display){ - this.el.querySelector('.show-total-to-customer') - .addEventListener('click', this.prepare_text_customer_display); - } - }; + /* TODO: understand why Odoo sends the prepare_text_customer_display + 3 times to the Posbox/LCD when the user clicks on the button + 'Show total to customer' */ + module.OrderWidget.include({ + update_summary: function(){ + console.log('MY update_summary'); + this._super(); + var self = this; + if (this.pos.config.iface_customer_display){ + console.log('.addEventListener'); + this.el.querySelector('.show-total-to-customer') + .removeEventListener('click', function(){self.pos.prepare_text_customer_display('addPaymentline', {})}); + this.el.querySelector('.show-total-to-customer') + .addEventListener('click', function(){self.pos.prepare_text_customer_display('addPaymentline', {})}); + } + }, + }); }; From bbee581e8a3348a8daf52e35b612076e64847f5a Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 12 Jun 2015 12:51:36 +0200 Subject: [PATCH 22/48] pos_customer_display: finish to convert all JS inherits to cleaner implementation --- .../static/src/js/customer_display.js | 86 +++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index 9f6afed4..a8df8976 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -12,7 +12,7 @@ openerp.pos_customer_display = function(instance){ module = instance.point_of_sale; var _t = instance.web._t; - + var PosModelSuper = module.PosModel; module.PosModel = module.PosModel.extend({ prepare_text_customer_display: function(type, data){ @@ -90,6 +90,14 @@ openerp.pos_customer_display = function(instance){ //console.log('prepare_text_customer_display type=' + type + ' | l1=' + lines_to_send[0] + ' | l2=' + lines_to_send[1]); }, + push_order: function(order){ + res = PosModelSuper.prototype.push_order.call(this, order); + if (order) { + this.prepare_text_customer_display('pushOrder', {'order' : order}); + } + return res; + }, + }); @@ -156,48 +164,40 @@ openerp.pos_customer_display = function(instance){ }, }); - var _super_addProduct_ = module.Order.prototype.addProduct; - module.Order.prototype.addProduct = function(product, options){ - res = _super_addProduct_.call(this, product, options); - if (product) { - this.pos.prepare_text_customer_display('addProduct', {'product' : product, 'options' : options}); - } - return res; - }; - - var _super_removeOrderline_ = module.Order.prototype.removeOrderline; - module.Order.prototype.removeOrderline = function(line){ - if (line) { - this.pos.prepare_text_customer_display('removeOrderline', {'line' : line}); - } - return _super_removeOrderline_.call(this, line); - }; - - var _super_removePaymentline_ = module.Order.prototype.removePaymentline; - module.Order.prototype.removePaymentline = function(line){ - if (line) { - this.pos.prepare_text_customer_display('removePaymentline', {'line' : line}); - } - return _super_removePaymentline_.call(this, line); - }; - - var _super_addPaymentline_ = module.Order.prototype.addPaymentline; - module.Order.prototype.addPaymentline = function(cashregister){ - res = _super_addPaymentline_.call(this, cashregister); - if (cashregister) { - this.pos.prepare_text_customer_display('addPaymentline', {'cashregister' : cashregister}); - } - return res; - }; - - var _super_pushOrder_ = module.PosModel.prototype.push_order; - module.PosModel.prototype.push_order = function(order){ - res = _super_pushOrder_.call(this, order); - if (order) { - this.prepare_text_customer_display('pushOrder', {'order' : order}); - } - return res; - }; + var OrderSuper = module.Order; + + module.Order = module.Order.extend({ + addProduct: function(product, options){ + res = OrderSuper.prototype.addProduct.call(this, product, options); + if (product) { + this.pos.prepare_text_customer_display('addProduct', {'product' : product, 'options' : options}); + } + return res; + }, + + removeOrderline: function(line){ + if (line) { + this.pos.prepare_text_customer_display('removeOrderline', {'line' : line}); + } + return OrderSuper.prototype.removeOrderline.call(this, line); + }, + + removePaymentline: function(line){ + if (line) { + this.pos.prepare_text_customer_display('removePaymentline', {'line' : line}); + } + return OrderSuper.prototype.removePaymentline.call(this, line); + }, + + addPaymentline: function(cashregister){ + res = OrderSuper.prototype.addPaymentline.call(this, cashregister); + if (cashregister) { + this.pos.prepare_text_customer_display('addPaymentline', {'cashregister' : cashregister}); + } + return res; + }, + + }); module.PaymentScreenWidget.include({ update_payment_summary: function(){ From d9c95a25705b5932cfc0cc0876f6b091d1b881a7 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 12 Jun 2015 20:01:23 +0200 Subject: [PATCH 23/48] Remove some console.log for debug --- pos_customer_display/static/src/js/customer_display.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index a8df8976..380112c4 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -234,11 +234,9 @@ openerp.pos_customer_display = function(instance){ 'Show total to customer' */ module.OrderWidget.include({ update_summary: function(){ - console.log('MY update_summary'); this._super(); var self = this; if (this.pos.config.iface_customer_display){ - console.log('.addEventListener'); this.el.querySelector('.show-total-to-customer') .removeEventListener('click', function(){self.pos.prepare_text_customer_display('addPaymentline', {})}); this.el.querySelector('.show-total-to-customer') From b35948699d8b28445d0d040bd1925c3275484f16 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 14 Jun 2015 00:19:53 +0200 Subject: [PATCH 24/48] Make some messages of customer display configurable JS code cleanup: harmonize identation --- .../customer_display_view.xml | 8 ++ pos_customer_display/i18n/fr.po | 81 ++++++++++++----- .../i18n/pos_customer_display.pot | 71 +++++++++++---- pos_customer_display/pos_customer_display.py | 45 +++++++++- .../static/src/js/customer_display.js | 86 +++++++++++-------- 5 files changed, 215 insertions(+), 76 deletions(-) diff --git a/pos_customer_display/customer_display_view.xml b/pos_customer_display/customer_display_view.xml index 80b238a6..b259f7be 100644 --- a/pos_customer_display/customer_display_view.xml +++ b/pos_customer_display/customer_display_view.xml @@ -10,6 +10,14 @@ + + + + + + + + diff --git a/pos_customer_display/i18n/fr.po b/pos_customer_display/i18n/fr.po index 06daa1f8..d937f091 100644 --- a/pos_customer_display/i18n/fr.po +++ b/pos_customer_display/i18n/fr.po @@ -6,30 +6,41 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-16 23:24+0000\n" -"PO-Revision-Date: 2015-05-16 23:24+0000\n" -"Last-Translator: Alexis de Lattre \n" +"POT-Creation-Date: 2015-06-13 22:12+0000\n" +"PO-Revision-Date: 2015-06-13 22:12+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: pos_customer_display +#: help:pos.config,customer_display_msg_next_l2:0 +msgid "Bottom line of the message on the customer display which is displayed after starting POS and also after validation of an order" +msgstr "Ligne du bas du message de l'afficheur client qui est affiché après le démarrage de la caisse et également après validation d'une commande client" + +#. module: pos_customer_display +#: help:pos.config,customer_display_msg_closed_l2:0 +msgid "Bottom line of the message on the customer display which is displayed when POS is closed" +msgstr "Ligne du bas du message de l'afficheur client qui est affiché quand la caisse est fermée" + #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:58 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:56 #, python-format msgid "Cancel Payment" msgstr "Paiement annulé" #. module: pos_customer_display +#: view:pos.config:pos_customer_display.view_pos_config_form2 #: field:pos.config,iface_customer_display:0 msgid "Customer Display" msgstr "Afficheur client" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:42 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:41 #, python-format msgid "Delete Item" msgstr "Article supprimé" @@ -53,40 +64,68 @@ msgstr "Longueur des lignes de l'afficheur client: nombre de caractères" #. module: pos_customer_display #: field:pos.config,customer_display_line_length:0 -msgid "Line Length" -msgstr "Longueur des lignes" +msgid "Line Length of the Customer Display" +msgstr "Longueur de ligne de l'afficheur client" #. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:71 +#: code:addons/pos_customer_display/pos_customer_display.py:63 +#: field:pos.config,customer_display_msg_next_l2:0 #, python-format -msgid "Next Customer" -msgstr "Client suivant" +msgid "Next Customer (bottom line)" +msgstr "Client suivant (ligne du bas)" #. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:83 +#: code:addons/pos_customer_display/pos_customer_display.py:62 +#: field:pos.config,customer_display_msg_next_l1:0 #, python-format -msgid "Point of Sale Closed" -msgstr "Caisse fermée" +msgid "Next Customer (top line)" +msgstr "Client suivant (ligne du haut)" #. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:77 +#: code:addons/pos_customer_display/pos_customer_display.py:66 +#: field:pos.config,customer_display_msg_closed_l2:0 +#, python-format +msgid "POS Closed (bottom line)" +msgstr "Caisse fermée (ligne du bas)" + +#. module: pos_customer_display +#: code:addons/pos_customer_display/pos_customer_display.py:65 +#: field:pos.config,customer_display_msg_closed_l1:0 #, python-format -msgid "Point of Sale Open" -msgstr "Caisse ouverte" +msgid "POS Closed (top line)" +msgstr "Caisse fermée (ligne du haut)" + +#. module: pos_customer_display +#: view:pos.config:pos_customer_display.view_pos_config_form2 +msgid "Receipt" +msgstr "Reçu" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:50 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:48 #, python-format msgid "TOTAL: " msgstr "TOTAL : " +#. module: pos_customer_display +#: code:addons/pos_customer_display/pos_customer_display.py:72 +#, python-format +msgid "The message for customer display '%s' is too long: it has %d chars whereas the maximum is %d chars." +msgstr "Le message de l'afficheur client '%s' est trop long : il contient %d caractères alors que le maximum est de %d caractères." + +#. module: pos_customer_display +#: help:pos.config,customer_display_msg_next_l1:0 +msgid "Top line of the message on the customer display which is displayed after starting POS and also after validation of an order" +msgstr "Ligne du haut du message de l'afficheur client qui est affiché après le démarrage de la caisse et également après validation d'une commande client" + +#. module: pos_customer_display +#: help:pos.config,customer_display_msg_closed_l1:0 +msgid "Top line of the message on the customer display which is displayed when POS is closed" +msgstr "Ligne du haut du message de l'afficheur client qui est affiché quand la caisse est fermée" + #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:65 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:63 #, python-format msgid "Your Change:" msgstr "Monnaie à rendre :" diff --git a/pos_customer_display/i18n/pos_customer_display.pot b/pos_customer_display/i18n/pos_customer_display.pot index 6ff26e33..7aa56659 100644 --- a/pos_customer_display/i18n/pos_customer_display.pot +++ b/pos_customer_display/i18n/pos_customer_display.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-16 23:24+0000\n" -"PO-Revision-Date: 2015-05-16 23:24+0000\n" +"POT-Creation-Date: 2015-06-13 22:11+0000\n" +"PO-Revision-Date: 2015-06-13 22:11+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,21 +15,32 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: pos_customer_display +#: help:pos.config,customer_display_msg_next_l2:0 +msgid "Bottom line of the message on the customer display which is displayed after starting POS and also after validation of an order" +msgstr "" + +#. module: pos_customer_display +#: help:pos.config,customer_display_msg_closed_l2:0 +msgid "Bottom line of the message on the customer display which is displayed when POS is closed" +msgstr "" + #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:58 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:56 #, python-format msgid "Cancel Payment" msgstr "" #. module: pos_customer_display +#: view:pos.config:pos_customer_display.view_pos_config_form2 #: field:pos.config,iface_customer_display:0 msgid "Customer Display" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:42 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:41 #, python-format msgid "Delete Item" msgstr "" @@ -53,40 +64,68 @@ msgstr "" #. module: pos_customer_display #: field:pos.config,customer_display_line_length:0 -msgid "Line Length" +msgid "Line Length of the Customer Display" msgstr "" #. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:71 +#: code:addons/pos_customer_display/pos_customer_display.py:63 +#: field:pos.config,customer_display_msg_next_l2:0 #, python-format -msgid "Next Customer" +msgid "Next Customer (bottom line)" msgstr "" #. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:83 +#: code:addons/pos_customer_display/pos_customer_display.py:62 +#: field:pos.config,customer_display_msg_next_l1:0 #, python-format -msgid "Point of Sale Closed" +msgid "Next Customer (top line)" msgstr "" #. module: pos_customer_display -#. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:77 +#: code:addons/pos_customer_display/pos_customer_display.py:66 +#: field:pos.config,customer_display_msg_closed_l2:0 +#, python-format +msgid "POS Closed (bottom line)" +msgstr "" + +#. module: pos_customer_display +#: code:addons/pos_customer_display/pos_customer_display.py:65 +#: field:pos.config,customer_display_msg_closed_l1:0 #, python-format -msgid "Point of Sale Open" +msgid "POS Closed (top line)" +msgstr "" + +#. module: pos_customer_display +#: view:pos.config:pos_customer_display.view_pos_config_form2 +msgid "Receipt" msgstr "" #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:50 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:48 #, python-format msgid "TOTAL: " msgstr "" +#. module: pos_customer_display +#: code:addons/pos_customer_display/pos_customer_display.py:72 +#, python-format +msgid "The message for customer display '%s' is too long: it has %d chars whereas the maximum is %d chars." +msgstr "" + +#. module: pos_customer_display +#: help:pos.config,customer_display_msg_next_l1:0 +msgid "Top line of the message on the customer display which is displayed after starting POS and also after validation of an order" +msgstr "" + +#. module: pos_customer_display +#: help:pos.config,customer_display_msg_closed_l1:0 +msgid "Top line of the message on the customer display which is displayed when POS is closed" +msgstr "" + #. module: pos_customer_display #. openerp-web -#: code:addons/pos_customer_display/static/src/js/customer_display.js:65 +#: code:addons/pos_customer_display/static/src/js/customer_display.js:63 #, python-format msgid "Your Change:" msgstr "" diff --git a/pos_customer_display/pos_customer_display.py b/pos_customer_display/pos_customer_display.py index 060e7881..9dbae58d 100644 --- a/pos_customer_display/pos_customer_display.py +++ b/pos_customer_display/pos_customer_display.py @@ -21,7 +21,8 @@ # ############################################################################## -from openerp import models, fields +from openerp import models, fields, api, _ +from openerp.exceptions import ValidationError class PosConfig(models.Model): @@ -30,5 +31,45 @@ class PosConfig(models.Model): iface_customer_display = fields.Boolean( string='Customer Display', help="Display data on the customer display") customer_display_line_length = fields.Integer( - string='Line Length', default=20, + string='Line Length of the Customer Display', default=20, help="Length of the LEDs lines of the customer display") + customer_display_msg_next_l1 = fields.Char( + string="Next Customer (top line)", default="Welcome!", + help="Top line of the message on the customer display which is " + "displayed after starting POS and also after validation of an order") + customer_display_msg_next_l2 = fields.Char( + string="Next Customer (bottom line)", default="Point of Sale Open", + help="Bottom line of the message on the customer display which is " + "displayed after starting POS and also after validation of an order") + customer_display_msg_closed_l1 = fields.Char( + string="POS Closed (top line)", default="Point of Sale Closed", + help="Top line of the message on the customer display which " + "is displayed when POS is closed") + customer_display_msg_closed_l2 = fields.Char( + string="POS Closed (bottom line)", default="See you soon!", + help="Bottom line of the message on the customer display which " + "is displayed when POS is closed") + + @api.one + @api.constrains( + 'customer_display_line_length', + 'customer_display_msg_next_l1', 'customer_display_msg_next_l2', + 'customer_display_msg_closed_l1', 'customer_display_msg_closed_l2') + def _check_customer_display_length(self): + if self.customer_display_line_length: + maxsize = self.customer_display_line_length + to_check = { + _('Next Customer (top line)'): self.customer_display_msg_next_l1, + _('Next Customer (bottom line)'): + self.customer_display_msg_next_l2, + _('POS Closed (top line)'): self.customer_display_msg_closed_l1, + _('POS Closed (bottom line)'): + self.customer_display_msg_closed_l2, + } + for field, msg in to_check.iteritems(): + if msg and len(msg) > maxsize: + raise ValidationError( + _("The message for customer display '%s' is too " + "long: it has %d chars whereas the maximum " + "is %d chars.") + % (field, len(msg), maxsize)) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index 380112c4..2f245d4f 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -66,20 +66,20 @@ openerp.pos_customer_display = function(instance){ } else if (type == 'pushOrder') { var lines_to_send = new Array( - this.proxy.align_center(_t("Next Customer"), line_length), - this.proxy.align_left(' ', line_length) + this.proxy.align_center(this.config.customer_display_msg_next_l1, line_length), + this.proxy.align_center(this.config.customer_display_msg_next_l2, line_length) ); } else if (type == 'openPOS') { var lines_to_send = new Array( - this.proxy.align_center(_t("Point of Sale Open"), line_length), - this.proxy.align_left(' ', line_length) + this.proxy.align_center(this.config.customer_display_msg_next_l1, line_length), + this.proxy.align_center(this.config.customer_display_msg_next_l2, line_length) ); } else if (type = 'closePOS') { var lines_to_send = new Array( - this.proxy.align_center(_t("Point of Sale Closed"), line_length), - this.proxy.align_left(' ', line_length) + this.proxy.align_center(this.config.customer_display_msg_closed_l1, line_length), + this.proxy.align_center(this.config.customer_display_msg_closed_l2, line_length) ); } else { console.warn('Unknown message type'); @@ -114,54 +114,66 @@ openerp.pos_customer_display = function(instance){ align_left: function(string, length){ if (string) { - if (string.length > length) - { - return string.substring(0,length); - } - else if (string.length < length) - { + if (string.length > length) + { + string = string.substring(0,length); + } + else if (string.length < length) + { while(string.length < length) - string = string + ' '; - return string; - } + string = string + ' '; + } + } + else { + string = ' ' + while(string.length < length) + string = ' ' + string; } return string; }, - align_right: function(string, length){ + align_right: function(string, length){ if (string) { if (string.length > length) - { - return string.substring(0,length); - } - else if (string.length < length) - { + { + string = string.substring(0,length); + } + else if (string.length < length) + { while(string.length < length) - string = ' ' + string; - return string; + string = ' ' + string; } - } - return string; - }, + } + else { + string = ' ' + while(string.length < length) + string = ' ' + string; + } + return string; + }, - align_center: function(string, length){ + align_center: function(string, length){ if (string) { if (string.length > length) { - return string.substring(0, length); + string = string.substring(0, length); } else if (string.length < length) { - ini = (length - string.length) / 2; - while(string.length < length - ini) - string = ' ' + string; - while(string.length < length) - string = string + ' '; - return string; + ini = (length - string.length) / 2; + while(string.length < length - ini) + string = ' ' + string; + while(string.length < length) + string = string + ' '; } - } - return string; - }, + } + else { + string = ' ' + while(string.length < length) + string = ' ' + string; + } + return string; + }, }); var OrderSuper = module.Order; From 9d6691a78fa81e5594ff42bb27d543b03ed31d41 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 14 Jun 2015 11:10:49 +0200 Subject: [PATCH 25/48] PEP8 --- pos_customer_display/pos_customer_display.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pos_customer_display/pos_customer_display.py b/pos_customer_display/pos_customer_display.py index 9dbae58d..9fae705b 100644 --- a/pos_customer_display/pos_customer_display.py +++ b/pos_customer_display/pos_customer_display.py @@ -59,10 +59,12 @@ class PosConfig(models.Model): if self.customer_display_line_length: maxsize = self.customer_display_line_length to_check = { - _('Next Customer (top line)'): self.customer_display_msg_next_l1, + _('Next Customer (top line)'): + self.customer_display_msg_next_l1, _('Next Customer (bottom line)'): self.customer_display_msg_next_l2, - _('POS Closed (top line)'): self.customer_display_msg_closed_l1, + _('POS Closed (top line)'): + self.customer_display_msg_closed_l1, _('POS Closed (bottom line)'): self.customer_display_msg_closed_l2, } From 032a179f52185d625ad2450f5986afe468d51836 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 22 Jun 2015 12:18:16 +0200 Subject: [PATCH 26/48] FIX when clicking on "Display Total to Customer", the query is now sent only once to the POSbox Patch written with the kind help of Sylvain Calador --- .../static/src/js/customer_display.js | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js index 2f245d4f..6ff84574 100755 --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -241,20 +241,16 @@ openerp.pos_customer_display = function(instance){ }); /* Handle Button "Display Total to Customer" */ - /* TODO: understand why Odoo sends the prepare_text_customer_display - 3 times to the Posbox/LCD when the user clicks on the button - 'Show total to customer' */ - module.OrderWidget.include({ - update_summary: function(){ - this._super(); - var self = this; - if (this.pos.config.iface_customer_display){ - this.el.querySelector('.show-total-to-customer') - .removeEventListener('click', function(){self.pos.prepare_text_customer_display('addPaymentline', {})}); - this.el.querySelector('.show-total-to-customer') - .addEventListener('click', function(){self.pos.prepare_text_customer_display('addPaymentline', {})}); - } - }, - }); + var _saved_renderElement = module.OrderWidget.prototype.renderElement; + module.OrderWidget.prototype.renderElement = function() { + _saved_renderElement.apply(this, arguments); + var self = this; + if (self.pos.config.iface_customer_display) { + self.el.querySelector('.show-total-to-customer') + .addEventListener('click', function(){ + self.pos.prepare_text_customer_display('addPaymentline', {}) + }); + } + }; }; From faa616bf03dd7b375da6cbde66d992d829c767b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Fri, 9 Oct 2015 10:01:54 +0200 Subject: [PATCH 27/48] [UPD] prefix versions with 8.0 --- pos_customer_display/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pos_customer_display/__openerp__.py b/pos_customer_display/__openerp__.py index 0b1072c7..6b3194df 100644 --- a/pos_customer_display/__openerp__.py +++ b/pos_customer_display/__openerp__.py @@ -22,7 +22,7 @@ { 'name': 'POS Customer Display', - 'version': '0.1', + 'version': '8.0.0.1.0', 'category': 'Point Of Sale', 'summary': 'Manage Customer Display device from POS front end', 'description': """ From a8fc9c3a7d69c05d7db9971480bfc69d36192843 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 14 Oct 2015 02:32:34 +0200 Subject: [PATCH 28/48] [MIG] Make modules uninstallable --- pos_customer_display/__openerp__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pos_customer_display/__openerp__.py b/pos_customer_display/__openerp__.py index 6b3194df..aded5625 100644 --- a/pos_customer_display/__openerp__.py +++ b/pos_customer_display/__openerp__.py @@ -57,4 +57,5 @@ Association ! ], 'qweb': ['static/src/xml/pos.xml'], 'demo': ['pos_customer_display_demo.xml'], + 'installable': False, } From 08c4b72c14ae741283db236b8a91f01f4c60e189 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 6 Oct 2016 16:04:41 +0200 Subject: [PATCH 29/48] [MIG] Rename manifest files --- pos_customer_display/{__openerp__.py => __manifest__.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pos_customer_display/{__openerp__.py => __manifest__.py} (100%) diff --git a/pos_customer_display/__openerp__.py b/pos_customer_display/__manifest__.py similarity index 100% rename from pos_customer_display/__openerp__.py rename to pos_customer_display/__manifest__.py From e5bcc8418c367b2b331506091c0d1aa2a9fdc56f Mon Sep 17 00:00:00 2001 From: Daniel Kraft Date: Sat, 17 Sep 2016 20:09:19 +0200 Subject: [PATCH 30/48] Make pos_customer_display odoo9 compatible --- pos_customer_display/__manifest__.py | 6 +- .../static/src/js/customer_display.js | 99 ++++++++++--------- .../{ => views}/customer_display_view.xml | 2 +- .../{ => views}/pos_customer_display.xml | 6 +- 4 files changed, 57 insertions(+), 56 deletions(-) mode change 100755 => 100644 pos_customer_display/static/src/js/customer_display.js rename pos_customer_display/{ => views}/customer_display_view.xml (94%) rename pos_customer_display/{ => views}/pos_customer_display.xml (58%) diff --git a/pos_customer_display/__manifest__.py b/pos_customer_display/__manifest__.py index aded5625..58a604ef 100644 --- a/pos_customer_display/__manifest__.py +++ b/pos_customer_display/__manifest__.py @@ -52,10 +52,10 @@ Association ! 'license': 'AGPL-3', 'depends': ['point_of_sale'], 'data': [ - 'pos_customer_display.xml', - 'customer_display_view.xml', + 'views/pos_customer_display.xml', + 'views/customer_display_view.xml', ], 'qweb': ['static/src/xml/pos.xml'], 'demo': ['pos_customer_display_demo.xml'], - 'installable': False, + 'installable': True, } diff --git a/pos_customer_display/static/src/js/customer_display.js b/pos_customer_display/static/src/js/customer_display.js old mode 100755 new mode 100644 index 6ff84574..e3d00e0a --- a/pos_customer_display/static/src/js/customer_display.js +++ b/pos_customer_display/static/src/js/customer_display.js @@ -8,23 +8,28 @@ The licence is in the file __openerp__.py */ -openerp.pos_customer_display = function(instance){ - module = instance.point_of_sale; +odoo.define('pos_customer_display', function(require) { + "use strict"; + var chrome = require('point_of_sale.chrome'); + var core = require('web.core'); + var devices = require('point_of_sale.devices'); + var gui = require('point_of_sale.gui'); + var models = require('point_of_sale.models'); + var screens = require('point_of_sale.screens'); + var _t = core._t; + var PosModelSuper = models.PosModel; - var _t = instance.web._t; - var PosModelSuper = module.PosModel; - - module.PosModel = module.PosModel.extend({ + models.PosModel = models.PosModel.extend({ prepare_text_customer_display: function(type, data){ if (this.config.iface_customer_display != true) return; var line_length = this.config.customer_display_line_length || 20; var currency_rounding = Math.ceil(Math.log(1.0 / this.currency.rounding) / Math.log(10)); - if (type == 'addProduct'){ + if (type == 'add_product'){ // in order to not recompute qty in options..., we assume that the new ordeLine is the last of the collection - // addOrderline exists but is not called by addProduct, should we handle it ? - var line = this.get('selectedOrder').getLastOrderline(); + // addOrderline exists but is not called by add_product, should we handle it ? + var line = this.get('selectedOrder').get_last_orderline(); var price_unit = line.get_unit_price() * (1.0 - (line.get_discount() / 100.0)); price_unit = price_unit.toFixed(currency_rounding); var l21 = line.get_quantity_str_with_unit() + ' x ' + price_unit; @@ -34,7 +39,7 @@ openerp.pos_customer_display = function(instance){ this.proxy.align_left(l21, line_length - l22.length) + l22 ); - } else if (type == 'removeOrderline') { + } else if (type == 'remove_orderline') { // first click on the backspace button set the amount to 0 => we can't precise the deleted qunatity and price var line = data['line']; var lines_to_send = new Array( @@ -42,14 +47,14 @@ openerp.pos_customer_display = function(instance){ this.proxy.align_right(line.get_product().display_name, line_length) ); - } else if (type == 'addPaymentline') { - var total = this.get('selectedOrder').getTotalTaxIncluded().toFixed(currency_rounding); + } else if (type == 'add_paymentline') { + var total = this.get('selectedOrder').get_total_with_tax().toFixed(currency_rounding); var lines_to_send = new Array( this.proxy.align_left(_t("TOTAL: "), line_length), this.proxy.align_right(total, line_length) ); - } else if (type == 'removePaymentline') { + } else if (type == 'remove_paymentline') { var line = data['line']; var amount = line.get_amount().toFixed(currency_rounding); var lines_to_send = new Array( @@ -64,7 +69,7 @@ openerp.pos_customer_display = function(instance){ this.proxy.align_right(change, line_length) ); - } else if (type == 'pushOrder') { + } else if (type == 'push_order') { var lines_to_send = new Array( this.proxy.align_center(this.config.customer_display_msg_next_l1, line_length), this.proxy.align_center(this.config.customer_display_msg_next_l2, line_length) @@ -91,17 +96,16 @@ openerp.pos_customer_display = function(instance){ }, push_order: function(order){ - res = PosModelSuper.prototype.push_order.call(this, order); + var res = PosModelSuper.prototype.push_order.call(this, order); if (order) { - this.prepare_text_customer_display('pushOrder', {'order' : order}); + this.prepare_text_customer_display('push_order', {'order' : order}); } return res; }, }); - - module.ProxyDevice = module.ProxyDevice.extend({ + devices.ProxyDevice = devices.ProxyDevice.extend({ send_text_customer_display: function(data, line_length){ //FIXME : this function is call twice. The first time, it is not called by prepare_text_customer_display : WHY ? if (_.isEmpty(data) || data.length != 2 || data[0].length != line_length || data[1].length != line_length){ @@ -160,7 +164,7 @@ openerp.pos_customer_display = function(instance){ } else if (string.length < length) { - ini = (length - string.length) / 2; + var ini = (length - string.length) / 2; while(string.length < length - ini) string = ' ' + string; while(string.length < length) @@ -176,64 +180,64 @@ openerp.pos_customer_display = function(instance){ }, }); - var OrderSuper = module.Order; + var OrderSuper = models.Order; - module.Order = module.Order.extend({ - addProduct: function(product, options){ - res = OrderSuper.prototype.addProduct.call(this, product, options); + models.Order = models.Order.extend({ + add_product: function(product, options){ + var res = OrderSuper.prototype.add_product.call(this, product, options); if (product) { - this.pos.prepare_text_customer_display('addProduct', {'product' : product, 'options' : options}); + this.pos.prepare_text_customer_display('add_product', {'product' : product, 'options' : options}); } return res; }, - removeOrderline: function(line){ + remove_orderline: function(line){ if (line) { - this.pos.prepare_text_customer_display('removeOrderline', {'line' : line}); + this.pos.prepare_text_customer_display('remove_orderline', {'line' : line}); } - return OrderSuper.prototype.removeOrderline.call(this, line); + return OrderSuper.prototype.remove_orderline.call(this, line); }, - removePaymentline: function(line){ + remove_paymentline: function(line){ if (line) { - this.pos.prepare_text_customer_display('removePaymentline', {'line' : line}); + this.pos.prepare_text_customer_display('remove_paymentline', {'line' : line}); } - return OrderSuper.prototype.removePaymentline.call(this, line); + return OrderSuper.prototype.remove_paymentline.call(this, line); }, - addPaymentline: function(cashregister){ - res = OrderSuper.prototype.addPaymentline.call(this, cashregister); + add_paymentline: function(cashregister){ + var res = OrderSuper.prototype.add_paymentline.call(this, cashregister); if (cashregister) { - this.pos.prepare_text_customer_display('addPaymentline', {'cashregister' : cashregister}); + this.pos.prepare_text_customer_display('add_paymentline', {'cashregister' : cashregister}); } return res; }, }); - module.PaymentScreenWidget.include({ - update_payment_summary: function(){ - res = this._super(); - var currentOrder = this.pos.get('selectedOrder'); - var paidTotal = currentOrder.getPaidTotal(); - var dueTotal = currentOrder.getTotalTaxIncluded(); + screens.PaymentScreenWidget.include({ + render_paymentlines: function(){ + var res = this._super(); + var currentOrder = this.pos.get_order(); + var paidTotal = currentOrder.get_total_paid(); + var dueTotal = currentOrder.get_total_with_tax(); var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0; if (change) { - change_rounded = change.toFixed(2); + var change_rounded = change.toFixed(2); this.pos.prepare_text_customer_display('update_payment', {'change': change_rounded}); } return res; }, }); - module.PosWidget.include({ + gui.Gui.include({ close: function(){ this._super(); this.pos.prepare_text_customer_display('closePOS', {}); }, }); - module.ProxyStatusWidget.include({ + chrome.ProxyStatusWidget.include({ start: function(){ this._super(); this.pos.prepare_text_customer_display('openPOS', {}); @@ -241,16 +245,17 @@ openerp.pos_customer_display = function(instance){ }); /* Handle Button "Display Total to Customer" */ - var _saved_renderElement = module.OrderWidget.prototype.renderElement; - module.OrderWidget.prototype.renderElement = function() { + var _saved_renderElement = screens.OrderWidget.prototype.renderElement; + screens.OrderWidget.prototype.renderElement = function() { _saved_renderElement.apply(this, arguments); var self = this; - if (self.pos.config.iface_customer_display) { + if (self.pos.config.iface_customer_display && self.el.querySelector('.show-total-to-customer')) { + // .show-total-to-customer is empty when we show the bon during payment self.el.querySelector('.show-total-to-customer') .addEventListener('click', function(){ - self.pos.prepare_text_customer_display('addPaymentline', {}) + self.pos.prepare_text_customer_display('add_paymentline', {}) }); } }; +}); -}; diff --git a/pos_customer_display/customer_display_view.xml b/pos_customer_display/views/customer_display_view.xml similarity index 94% rename from pos_customer_display/customer_display_view.xml rename to pos_customer_display/views/customer_display_view.xml index b259f7be..91b52821 100644 --- a/pos_customer_display/customer_display_view.xml +++ b/pos_customer_display/views/customer_display_view.xml @@ -10,7 +10,7 @@ - + diff --git a/pos_customer_display/pos_customer_display.xml b/pos_customer_display/views/pos_customer_display.xml similarity index 58% rename from pos_customer_display/pos_customer_display.xml rename to pos_customer_display/views/pos_customer_display.xml index c559baa3..4c7db0da 100644 --- a/pos_customer_display/pos_customer_display.xml +++ b/pos_customer_display/views/pos_customer_display.xml @@ -1,13 +1,9 @@ -