summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Laffineur lla <lla@odoo.com>2016-01-11 10:17:03 +0100
committerLudovic Laffineur lla <lla@odoo.com>2016-01-11 10:49:45 +0100
commitf975cefcb8031f4d80ec43e1d2f09a6741187c2f (patch)
tree3de8ecfa979bcc9cb4b04a315f5e6df3c01ae8b7
parent580389add8d231d56bf4a438ff571e4831c86f22 (diff)
[FIX] Improve performance of the scheduler.
This commit improves performances of the scheduler when the database is big (lots of products with lots of fields). This avoids prefetching all the fields for every 1000 products while we only use 2 of them.
-rw-r--r--addons/stock/product.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/stock/product.py b/addons/stock/product.py
index 21e5512383d..2e7b8a6a2ec 100644
--- a/addons/stock/product.py
+++ b/addons/stock/product.py
@@ -169,7 +169,9 @@ class product_product(osv.osv):
moves_in = dict(map(lambda x: (x['product_id'][0], x['product_qty']), moves_in))
moves_out = dict(map(lambda x: (x['product_id'][0], x['product_qty']), moves_out))
res = {}
- for product in self.browse(cr, uid, ids, context=context):
+ ctx = context.copy()
+ ctx.update({'prefetch_fields': False})
+ for product in self.browse(cr, uid, ids, context=ctx):
id = product.id
qty_available = float_round(quants.get(id, 0.0), precision_rounding=product.uom_id.rounding)
incoming_qty = float_round(moves_in.get(id, 0.0), precision_rounding=product.uom_id.rounding)