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