From fb9caab7c1352c8181c08343e1374b96aa29d1e4 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Mon, 22 Jul 2019 11:40:49 +0000 Subject: [PATCH] [FIX] website_quote: negative discounts are always included in the display price Before this commit, negative discounts (surcharges) were shown in the sales order when the price list have the option : "Show public price & discount to the customer". Now, the negative discounts are included in the display price. This issue was already been addressed in the sales module (see https://github.com/odoo/odoo/blob/ac170e8a8238a9b0aa468f83b11aabc4cd9493de/addons/sale/models/sale.py#L1046) Fine-tunning of : cae506f0ed26625f99ab1614f90e45e7ac72c205 opw-2039071 closes odoo/odoo#35065 Signed-off-by: Jorge Pinna Puissant (jpp) --- addons/website_quote/models/sale_order.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/website_quote/models/sale_order.py b/addons/website_quote/models/sale_order.py index 8d8931cd01c..69199f1c8ef 100644 --- a/addons/website_quote/models/sale_order.py +++ b/addons/website_quote/models/sale_order.py @@ -122,7 +122,11 @@ class SaleOrder(models.Model): price = self.pricelist_id.with_context(uom=line.product_uom_id.id).get_product_price(line.product_id, line.product_uom_qty, False) if self.pricelist_id.discount_policy == 'without_discount' and line.price_unit: discount = (line.price_unit - price) / line.price_unit * 100 - price = line.price_unit + # negative discounts (= surcharge) are included in the display price + if discount < 0: + discount = 0 + else: + price = line.price_unit else: price = line.price_unit