summaryrefslogtreecommitdiff
path: root/addons/point_of_sale/static/src
diff options
context:
space:
mode:
authorAnh Thao Pham (pta) <pta@odoo.com>2020-10-19 14:37:46 +0000
committerAnh Thao Pham (pta) <pta@odoo.com>2020-10-19 14:37:46 +0000
commit7687732a8a2e1afe87272fc31ccd4437ed9a8db1 (patch)
treeb5018ff3a7faf55e5eb72f4fda14ca1f0fd35142 /addons/point_of_sale/static/src
parent1c0db7b2f4e5bdfba921e82e6872ac13d44f9d7a (diff)
[FIX] point_of_sale: fix decimals converted into units after parse
In a POS session, in a language that does not use dot (.) as decimal separator (i.e. French), when adding a Product, it can happen that the decimal part of the price is not converted correctly after applying "field_utils.parse.float". (i.e. 2.69 becomes 269) The issue happens in "set_unit_price" function. To prevent this to happen, "field_utils.parse.float" will only be applied if the price given as parameter is not a number. opw-2357848 closes odoo/odoo#60294 Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
Diffstat (limited to 'addons/point_of_sale/static/src')
-rw-r--r--addons/point_of_sale/static/src/js/models.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index a7d826eacd9..ce08a5afd43 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -1949,7 +1949,9 @@ exports.Orderline = Backbone.Model.extend({
// changes the base price of the product for this orderline
set_unit_price: function(price){
this.order.assert_editable();
- var parsed_price = isNaN(parseFloat(price)) ? 0 : field_utils.parse.float('' + price)
+ var parsed_price = !isNaN(price) ?
+ price :
+ isNaN(parseFloat(price)) ? 0 : field_utils.parse.float('' + price)
this.price = round_di(parsed_price || 0, this.pos.dp['Product Price']);
this.trigger('change',this);
},