From cbb18848f635cee60bd365b1433e1e062fdba306 Mon Sep 17 00:00:00 2001 From: Ethan Vincent Date: Mon, 15 Apr 2024 11:56:02 +0200 Subject: [PATCH] [FIX] sale_management: (revert) handle temp recs This PR reverts the commit https://github.com/odoo/odoo/commit/c6842f1 opw-3754297 closes odoo/odoo#161868 Signed-off-by: Victor Feyens (vfe) --- addons/sale_management/models/sale_order_option.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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()