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)