[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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user