From 09f24de5d3340ac32312ac654bc4803ce4042817 Mon Sep 17 00:00:00 2001 From: Gert Pellin Date: Fri, 30 Nov 2018 12:07:07 +0000 Subject: [PATCH] [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 --- 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 02afd3d085f..11d769967ba 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -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;