diff --git a/addons/sale_management/models/sale_order_option.py b/addons/sale_management/models/sale_order_option.py index dd428ad3fd018..a5ecc6a4ddaa5 100644 --- a/addons/sale_management/models/sale_order_option.py +++ b/addons/sale_management/models/sale_order_option.py @@ -89,8 +89,8 @@ def _compute_price_unit(self): new_sol = self.env['sale.order.line'].new(values) new_sol._compute_price_unit() option.price_unit = new_sol.price_unit - # Avoid attaching the new line when called on template change - new_sol.order_id = False + # Drop the temporary record from the cache + new_sol.invalidate_recordset(flush=False) @api.depends('product_id', 'uom_id', 'quantity') def _compute_discount(self): @@ -102,8 +102,8 @@ def _compute_discount(self): new_sol = self.env['sale.order.line'].new(values) new_sol._compute_discount() option.discount = new_sol.discount - # Avoid attaching the new line when called on template change - new_sol.order_id = False + # Drop the temporary record from the cache + new_sol.invalidate_recordset(flush=False) def _get_values_to_add_to_order(self): self.ensure_one()