From 57de89982aefa3a3f31b9054478e38b03740f7fe Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 7 Dec 2020 15:57:53 +0000 Subject: [PATCH] [FIX] sale: Optional product price MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: - Let's consider a product P with sale UOM = Unit and unit price = 10€ - Create a SO and add a sale.order.option SOO with P and Dozen as UOM Bug: The unit price was 10€ instead of 120€ opw:2413237 closes odoo/odoo#62992 X-original-commit: 880555b38dee0c3e3b364c19bb6b0db983bf8aa0 Signed-off-by: Simon Goffin (sig) --- 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 aa9e1102da1..2df7f0d9f23 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1642,7 +1642,7 @@ class SaleOrderLine(models.Model): ) if self.order_id.pricelist_id.discount_policy == 'with_discount': - return product.with_context(pricelist=self.order_id.pricelist_id.id).price + return product.with_context(pricelist=self.order_id.pricelist_id.id, uom=self.product_uom.id).price product_context = dict(self.env.context, partner_id=self.order_id.partner_id.id, date=self.order_id.date_order, uom=self.product_uom.id) final_price, rule_id = self.order_id.pricelist_id.with_context(product_context).get_product_price_rule(product or self.product_id, self.product_uom_qty or 1.0, self.order_id.partner_id)