From db994ca57af4f09953946dede3950c2eb7a94871 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 18 Jul 2018 16:13:37 +0200 Subject: [PATCH] [FIX] sale: do not always overwrite discount on soline Before this commit, the discount on a so line was always brought to zero when changing the price After this commit, we do this only when the pricelist is supposed to compute the discount OPW 1867262 closes #25851 --- 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 633a2d0ff41..f226767ba6f 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1007,13 +1007,13 @@ class SaleOrderLine(models.Model): @api.onchange('product_id', 'price_unit', 'product_uom', 'product_uom_qty', 'tax_id') def _onchange_discount(self): - self.discount = 0.0 if not (self.product_id and self.product_uom and self.order_id.partner_id and self.order_id.pricelist_id and self.order_id.pricelist_id.discount_policy == 'without_discount' and self.env.user.has_group('sale.group_discount_per_so_line')): return + self.discount = 0.0 product = self.product_id.with_context( lang=self.order_id.partner_id.lang, partner=self.order_id.partner_id.id,