diff options
| author | Richard Mathot <rim@odoo.com> | 2017-08-29 12:28:41 +0200 |
|---|---|---|
| committer | Richard Mathot <rim@odoo.com> | 2017-08-29 12:28:41 +0200 |
| commit | ccfc4e7026e2ab03a2adda526f890ca810e0da70 (patch) | |
| tree | 971ea85febdf6e972289e5532835be5b5c767e02 | |
| parent | 428ad2dfe3a0c2150bd24350c70927931b87b3e7 (diff) | |
[FIX] mrp: optimize computation of field "# Manufacturing Orders"
| -rw-r--r-- | addons/mrp/product.py | 7 |
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 = { |
