From bc3ee30504a37c2eb22df9f24547d90c35e15a68 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Tue, 28 May 2019 09:54:44 +0000 Subject: [PATCH] [FIX] sale: discount in pricelist for negative price Having : - a pricelist with 10% of discount for all the products. - the discount policy in the pricelist set to : "Show public price & discount to the customer" - a product with negative price (ex : -$125) - add the product in a SO with the 10% pricelist Before this commit, the unit price was the price with the discount already applied: -$112.5, and not the original price as expected; The subtotal price was $101,25 (the discount is applied twice) which is wrong. Now, the unit price is -$112.5 as expected, in Odoo surcharge are always included in the display price. opw-1986582 closes odoo/odoo#33717 Signed-off-by: Nicolas Lempereur (nle) --- addons/sale/models/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index e8954205d2e..d190f32f70d 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1640,7 +1640,7 @@ class SaleOrderLine(models.Model): new_list_price, self.order_id.pricelist_id.currency_id, self.order_id.company_id, self.order_id.date_order or fields.Date.today()) discount = (new_list_price - price) / new_list_price * 100 - if discount > 0: + if (discount > 0 and new_list_price > 0) or (discount < 0 and new_list_price < 0): self.discount = discount def _is_delivery(self):