From cb5f00f58016d087cf5387c3eadf9144f45a0397 Mon Sep 17 00:00:00 2001 From: dhr-odoo Date: Fri, 31 Oct 2014 14:18:35 +0530 Subject: [PATCH] [FIX] orm: ordering on >1000 records When reading over IN_MAX (currently 1000) records, the select is slip into subsets of IN_MAX records. However the list of ids was split using set() method which removes order that may have been pass. The subsets are ordered using _order attribute but the subsets were not ordered between themself. This is an issue in case of browsing a o2m field with more than 1000 lines as it will return sorted blocked but the order of the blocks is the order of the contained ids (e.g. split(2, [5, 4, 3, 2, 1]) -> [[2,1], [4,3], [5]]). Removes the set() to make sure the order of the given ids is preserved. opw 616070, linked to #439 --- openerp/sql_db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/sql_db.py b/openerp/sql_db.py index 39c87049fb0..8571b3ba08f 100644 --- a/openerp/sql_db.py +++ b/openerp/sql_db.py @@ -255,7 +255,7 @@ class Cursor(object): def split_for_in_conditions(self, ids): """Split a list of identifiers into one or more smaller tuples safe for IN conditions, after uniquifying them.""" - return tools.misc.split_every(self.IN_MAX, set(ids)) + return tools.misc.split_every(self.IN_MAX, ids) def print_log(self): global sql_counter