From 5a10903e9b3b3f8143a8f8d3703632e3243efead Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 20 May 2015 12:38:44 +0200 Subject: [PATCH] [FIX] point_of_sale: float format The POS must adapt the float format according to the language of the user. Inspired from 1da5d89ba32526f241b3a0ce82b25a2fa9ee858f opw:639567 --- addons/point_of_sale/static/src/js/screens.js | 10 +++++++++- addons/point_of_sale/static/src/js/widget_base.js | 1 + addons/point_of_sale/static/src/xml/pos.xml | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 6a813f2d574..b96af46757c 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1008,6 +1008,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa },this); this.bind_events(); + this.decimal_point = instance.web._t.database.parameters.decimal_point; this.line_delete_handler = function(event){ var node = this; @@ -1026,7 +1027,14 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa node = node.parentNode; } if(node){ - node.line.set_amount(this.value); + var amount; + try{ + amount = instance.web.parse_value(this.value, {type: "float"}); + } + catch(e){ + amount = 0; + } + node.line.set_amount(amount); } }; diff --git a/addons/point_of_sale/static/src/js/widget_base.js b/addons/point_of_sale/static/src/js/widget_base.js index 934cc130a6c..5d1ff78fab2 100644 --- a/addons/point_of_sale/static/src/js/widget_base.js +++ b/addons/point_of_sale/static/src/js/widget_base.js @@ -29,6 +29,7 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of if (typeof amount === 'number') { amount = round_di(amount,decimals).toFixed(decimals); + amount = openerp.instances[this.session.name].web.format_value(parseFloat(amount), { type : 'float' }); } if (currency.position === 'after') { diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index c9dd59305ba..0a7ced2cd26 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -873,7 +873,10 @@
- +