From 2f098b25834a7a16d317c2a41f72d7510125fe59 Mon Sep 17 00:00:00 2001 From: "Touati Djamel (otd)" Date: Thu, 24 Jun 2021 11:20:47 +0000 Subject: [PATCH] [FIX] stock_landed_cost: added a missing return on the overridden write function commit where the bug was introduced : https://github.com/odoo/odoo/pull/71810/commits/7b87ab31ee64d56c6e7f9eab7a51d81cf4e66747 opw-2572132 closes odoo/odoo#72751 X-original-commit: 94d1e807379ca7d92d5a4df267857cb00f979710 Signed-off-by: William Henrotin Signed-off-by: Djamel Touati --- addons/stock_landed_costs/models/product.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock_landed_costs/models/product.py b/addons/stock_landed_costs/models/product.py index 52cec5828c8..02a34d300c1 100644 --- a/addons/stock_landed_costs/models/product.py +++ b/addons/stock_landed_costs/models/product.py @@ -18,6 +18,6 @@ class ProductTemplate(models.Model): if (('type' in vals and vals['type'] != 'service') or ('landed_cost_ok' in vals and not vals['landed_cost_ok'])) and product.type == 'service' and product.landed_cost_ok: if self.env['account.move.line'].search_count([('product_id', 'in', product.product_variant_ids.ids), ('is_landed_costs_line', '=', True)]): raise UserError(_("You cannot change the product type or disable landed cost option because the product is used in an account move line.")) - else: - vals['landed_cost_ok'] = False - super(ProductTemplate, product).write(vals) + vals['landed_cost_ok'] = False + + return super().write(vals)