[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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user