diff --git a/addons/mrp/models/product.py b/addons/mrp/models/product.py index 7ecc6274636..25ef11da9a3 100644 --- a/addons/mrp/models/product.py +++ b/addons/mrp/models/product.py @@ -44,7 +44,12 @@ class ProductProduct(models.Model): read_group_res = self.env['mrp.bom'].read_group([('product_id', 'in', self.ids)], ['product_id'], ['product_id']) mapped_data = dict([(data['product_id'][0], data['product_id_count']) for data in read_group_res]) for product in self: - product.bom_count = mapped_data.get(product.id, 0) + if product.product_tmpl_id.product_variant_count == 1: + bom_count = mapped_data.get(product.id, product.product_tmpl_id.bom_count) + else: + bom_count = mapped_data.get(product.id, 0) + product.bom_count = bom_count + def _compute_mo_count(self): read_group_res = self.env['mrp.production'].read_group([('product_id', 'in', self.ids)], ['product_id'], ['product_id'])