From 63407a4716cbbc372fe1b375f4c7e43acd3f4bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 18 Oct 2009 19:36:55 +0200 Subject: [PATCH] Add AS to select field in search to fix column names in dictfetchall with SQLite --- trytond/model/modelsql.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index db21d1cc03..4217b1238b 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -1186,7 +1186,7 @@ class ModelSQL(ModelStorage): res = cursor.fetchall() return res[0][0] # execute the "main" query to fetch the ids we were searching for - select_fields = ['"' + self._table + '".id'] + select_fields = ['"' + self._table + '".id AS id'] if self._history and context.get('_datetime') \ and not query_string: select_fields += ['COALESCE("' + self._table + '".write_date, "' + \ @@ -1195,7 +1195,7 @@ class ModelSQL(ModelStorage): select_fields += [(x[0] in ('create_date', 'write_date')) \ and ('date_trunc(\'second\', "' + \ self._table + '"."' + x[0] + '") AS "' + x[0] + '"') \ - or '"' + self._table + '"."' + x[0] + '"' \ + or '"' + self._table + '"."' + x[0] + '" AS "' + x[0] + '"' \ for x in self._columns.iteritems() \ if not hasattr(x[1], 'get') \ and (x[0] != 'id')