From eae609617a9598497dc3bab6fabe19cc1de62401 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 17 May 2015 01:51:59 +0200 Subject: [PATCH] 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 @@ + + + + + +
+ +
+
+
+
+