summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/mrp/product.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/mrp/product.py b/addons/mrp/product.py
index 41e6d0a9049..13f54e711ba 100644
--- a/addons/mrp/product.py
+++ b/addons/mrp/product.py
@@ -46,11 +46,12 @@ class product_template(osv.osv):
class product_product(osv.osv):
_inherit = "product.product"
+
def _bom_orders_count(self, cr, uid, ids, field_name, arg, context=None):
Production = self.pool('mrp.production')
- res = {}
- for product_id in ids:
- res[product_id] = Production.search_count(cr,uid, [('product_id', '=', product_id)], context=context)
+ res = dict.fromkeys(ids, 0)
+ for g in Production.read_group(cr, uid, [('product_id', 'in', ids)], ['product_id'], ['product_id'], context=context):
+ res[g['partner_id'][0]] = g['partner_id_count']
return res
_columns = {