diff --git a/addons/mrp_bom_cost/models/product.py b/addons/mrp_bom_cost/models/product.py index fc0f56be631..da15e757cb3 100644 --- a/addons/mrp_bom_cost/models/product.py +++ b/addons/mrp_bom_cost/models/product.py @@ -11,11 +11,13 @@ class ProductTemplate(models.Model): def action_bom_cost(self): templates = self.filtered(lambda t: t.product_variant_count == 1 and t.bom_count > 0) - return templates.mapped('product_variant_id').action_bom_cost() + if templates: + return templates.mapped('product_variant_id').action_bom_cost() def button_bom_cost(self): templates = self.filtered(lambda t: t.product_variant_count == 1 and t.bom_count > 0) - return templates.mapped('product_variant_id').button_bom_cost() + if templates: + return templates.mapped('product_variant_id').button_bom_cost() class ProductProduct(models.Model):