[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#60344 X-original-commit: 7687732a8a2e1afe87272fc31ccd4437ed9a8db1 Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
This commit is contained in:
@@ -1924,7 +1924,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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user