[FIX] read: fix performance issue due to O(n)^2 sorting
bzr revid: fva@openerp.com-20140123161523-xvc8so45uwj3uivs
This commit is contained in:
parent
27224c9b9e
commit
2f2c1057b3
|
@ -1084,7 +1084,12 @@ class DataSet(openerpweb.Controller):
|
|||
}
|
||||
|
||||
records = Model.read(ids, fields or False, req.context)
|
||||
records.sort(key=lambda obj: ids.index(obj['id']))
|
||||
|
||||
index = {}
|
||||
for r in records:
|
||||
index[r['id']] = r
|
||||
records = [index[x] for x in ids if x in index]
|
||||
|
||||
return {
|
||||
'length': length,
|
||||
'records': records
|
||||
|
|
Loading…
Reference in New Issue