[FIX] point_of_sale: group products with pricelist

Before this fix products in a pricelist would not be grouped when there
is a decimal value in the price.

This problem was caused by a trailing rounding error, for instance a
price of 29.90 could give a pricelist price of 29.900000000002. To solve
this we check if Math.round((price - pricelist-price)/currency-rounding)
gives 0 as a result, if so, the price is equal to the pricelist price
and the product can be grouped.

solves: https://github.com/odoo/odoo/issues/28521#issuecomment-443148920

closes odoo/odoo#29185
This commit is contained in:
Gert Pellin
2018-12-05 12:25:35 +00:00
parent da18c1a115
commit 09f24de5d3
+2 -1
View File
@@ -1525,7 +1525,8 @@ exports.Orderline = Backbone.Model.extend({
return false;
}else if(this.get_discount() > 0){ // we don't merge discounted orderlines
return false;
}else if(price !== orderline.get_product().get_price(orderline.order.pricelist, this.get_quantity())){
}else if(!utils.float_is_zero(price - orderline.get_product().get_price(orderline.order.pricelist, this.get_quantity()),
this.pos.currency.decimals)){
return false;
}else if(this.product.tracking == 'lot') {
return false;