From e23c5ef3ddc2432c9960f55f4d49b2261deab97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 4 Jun 2009 09:14:33 +0200 Subject: [PATCH] Backed out changeset 669b79e387c3 --- trytond/model/modelsql.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index ab65a0565d..df354e3129 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -1981,14 +1981,10 @@ class ModelSQL(ModelStorage): 'WHERE id IN (' + ','.join(['%s' for x in child_ids]) + ')', child_ids) - if parent_id is False: - cursor.execute('SELECT id FROM "' + self._table + '" WHERE "' +\ - field_name + '" IS NULL') - else: - cursor.execute('SELECT id FROM "' + self._table + '" WHERE "' +\ - field_name + '" = %s', (parent_id,)) - brother_ids = [x[0] for x in cursor.fetchall()] - + # Use root user to by-pass rules + brother_ids = self.search(cursor, 0, [ + (field_name, '=', parent_id), + ]) if brother_ids[-1] != object_id: next_id = brother_ids[brother_ids.index(object_id) + 1] cursor.execute('SELECT "' + left + '", "' + right + '" ' \