[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.
This commit is contained in:
Ludovic Laffineur lla
2016-01-11 10:49:45 +01:00
parent 580389add8
commit f975cefcb8
+3 -1
View File
@@ -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)