From cadc9c40f064aeefa2d0edb542e61d7abe269f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 30 Sep 2009 14:42:00 +0200 Subject: [PATCH] Fix _sql_constraints validation when there is duplicated id in list for issue1198 --- trytond/model/modelsql.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index f0079318f0..708fab4d91 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -2160,13 +2160,12 @@ class ModelSQL(ModelStorage): 'FROM "' + self._table + '" ' \ 'WHERE ' + red_sql, red_ids) + fetchall = cursor.fetchall() cursor.execute('SELECT id ' \ 'FROM "' + self._table + '" ' \ 'WHERE ' + \ - ' OR '.join((sql_clause,) * len(sub_ids)), - reduce(lambda x, y: x + list(y), - cursor.fetchall(), - [])) + ' OR '.join((sql_clause,) * len(fetchall)), + reduce(lambda x, y: x + list(y), fetchall, [])) if cursor.fetchone(): self.raise_user_error(cursor, error, context=context)