From 8ce07db532008624ee2adf88e2abcdcd9363f036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 8 Sep 2008 12:46:06 +0200 Subject: [PATCH] Fix _timestamp for table_query --- trytond/osv/orm.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/trytond/osv/orm.py b/trytond/osv/orm.py index 25932b9fc5..5111b6f971 100644 --- a/trytond/osv/orm.py +++ b/trytond/osv/orm.py @@ -1023,9 +1023,12 @@ class ORM(object): or '"' + x + '"' for x in fields_pre \ if x != '_timestamp'] if '_timestamp' in fields_pre: - fields_pre2 += ['(CASE WHEN write_date IS NOT NULL ' \ - 'THEN write_date ELSE create_date END) ' \ - 'AS _timestamp'] + if not self.table_query(context): + fields_pre2 += ['(CASE WHEN write_date IS NOT NULL ' \ + 'THEN write_date ELSE create_date END) ' \ + 'AS _timestamp'] + else: + fields_pre2 += ['now()::timestamp AS _timestamp'] for i in range(0, len(ids), cursor.IN_MAX): sub_ids = ids[i:i + cursor.IN_MAX] if domain1: