diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 7be957bf4e2..f847f7734b0 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -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