diff --git a/addons/sale_management/models/sale_order.py b/addons/sale_management/models/sale_order.py index 4ed4ebd69d4..165d5acf59b 100644 --- a/addons/sale_management/models/sale_order.py +++ b/addons/sale_management/models/sale_order.py @@ -220,11 +220,19 @@ class SaleOrderOption(models.Model): return [('line_id', '=', False)] return [('line_id', '!=', False)] - @api.onchange('product_id', 'uom_id') + @api.onchange('product_id', 'uom_id', 'quantity') def _onchange_product_id(self): if not self.product_id: return - product = self.product_id.with_context(lang=self.order_id.partner_id.lang) + product = self.product_id.with_context( + lang=self.order_id.partner_id.lang, + partner=self.order_id.partner_id, + quantity=self.quantity, + date=self.order_id.date_order, + pricelist=self.order_id.pricelist_id.id, + uom=self.uom_id.id, + fiscal_position=self.env.context.get('fiscal_position') + ) self.name = product.get_product_multiline_description_sale() self.uom_id = self.uom_id or product.uom_id # To compute the discount a so line is created in cache