[MERGE] procurement: performance issue. Courtesy of Holger Brunn (Therp)
lp bug: https://launchpad.net/bugs/1297887 fixed bzr revid: qdp-launchpad@openerp.com-20140403095358-2jqitwe6se5p4mn5
This commit is contained in:
@@ -192,7 +192,11 @@ class procurement_order(osv.osv):
|
||||
return self.write(cr, uid, ids, {'state': 'confirmed'}, context=context)
|
||||
|
||||
def run(self, cr, uid, ids, context=None):
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
for procurement_id in ids:
|
||||
#we intentionnaly do the browse under the for loop to avoid caching all ids which would be ressource greedy
|
||||
#and useless as we'll make a refresh later that will invalidate all the cache (and thus the next iteration
|
||||
#will fetch all the ids again)
|
||||
procurement = self.browse(cr, uid, procurement_id, context=context)
|
||||
if procurement.state not in ("running", "done"):
|
||||
if self._assign(cr, uid, procurement, context=context):
|
||||
procurement.refresh()
|
||||
|
||||
Reference in New Issue
Block a user