From 2c0529858fb2119252a4c04a0018ee6adaa2d520 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 21 May 2015 10:23:56 +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 cbd6779f33c..11641c36614 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -885,6 +885,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; @@ -903,7 +904,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 443d66647a1..5d676e53d37 100644 --- a/addons/point_of_sale/static/src/js/widget_base.js +++ b/addons/point_of_sale/static/src/js/widget_base.js @@ -31,6 +31,7 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of if(typeof amount === 'number'){ amount = Math.round(amount*100)/100; amount = amount.toFixed(decimals); + amount = openerp.instances[this.session.name].web.format_value(parseFloat(amount), { type : 'float' }); } if(this.currency.position === 'after'){ return amount + ' ' + (this.currency.symbol || ''); diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 1afd0fe4359..68c07c25a01 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -588,7 +588,10 @@
- +