From eca99f1f12174cc59e7ff93c40a3aedc2d422049 Mon Sep 17 00:00:00 2001 From: len-odoo Date: Tue, 10 Apr 2018 09:05:55 +0200 Subject: [PATCH] [FIX] point_of_sale: fix quantity rounding When the user set a decimal accuracy on the product quantity, the point_of_sale (POS) frontend would display the correct rounding of the quantity according to both the decimal accuracy and the rounding set on the unit of measure. However the quantity used to compute the price was only using the rouding on the unit of measure. This led to an inconsistency in what is encoded in the backend, and thus made it impossible to close the session as the price paid by customers did not match what is encoded. The problem comes from the fact that there is a variable this.quantity and another one to display this.quantityStr. Unsurprisingly, this.quantityStr was not computed directly from this.quantity, leading to the inconsistency. opw 1826092 --- addons/point_of_sale/static/src/js/models.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 6e12dc8b114..25b31fd0b8f 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1152,7 +1152,8 @@ exports.Orderline = Backbone.Model.extend({ if (unit.rounding) { this.quantity = round_pr(quant, unit.rounding); var decimals = this.pos.dp['Product Unit of Measure']; - this.quantityStr = formats.format_value(round_di(this.quantity, decimals), { type: 'float', digits: [69, decimals]}); + this.quantity = round_di(this.quantity, decimals) + this.quantityStr = formats.format_value(this.quantity, { type: 'float', digits: [69, decimals]}); } else { this.quantity = round_pr(quant, 1); this.quantityStr = this.quantity.toFixed(0);