From 68f271613ab4596880941dcd40980a40118c642e Mon Sep 17 00:00:00 2001 From: ced <> Date: Tue, 19 Jun 2007 14:15:13 +0000 Subject: [PATCH] KERNEL: fix create_date and write_date as there are timestamp now bzr revid: ced-54cda387806fb989cf811807e4af06c5a37e3c51 --- bin/osv/orm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 73c34102bc7..2fda44a1903 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -734,12 +734,13 @@ class orm(object): fields_pre = filter(lambda x: x in self._columns and getattr(self._columns[x],'_classic_write'), fields) + self._inherits.values() if len(fields_pre) : + fields_pre2 = map(lambda x: (x in ('create_date', 'write_date')) and ('date_trunc(\'second\', '+x+') as '+x) or x, fields_pre) if d1: - cr.execute('select %s from %s where id in (%s) and %s order by %s' % (','.join(fields_pre + ['id']), self._table, ','.join([str(x) for x in ids]), d1, self._order),d2) + cr.execute('select %s from %s where id in (%s) and %s order by %s' % (','.join(fields_pre2 + ['id']), self._table, ','.join([str(x) for x in ids]), d1, self._order),d2) if not cr.rowcount == len({}.fromkeys(ids)): raise except_orm('AccessError', 'You try to bypass an access rule (Document type: %s).' % self._description) else: - cr.execute('select %s from %s where id in (%s) order by %s' % (','.join(fields_pre + ['id']), self._table, ','.join([str(x) for x in ids]), self._order)) + cr.execute('select %s from %s where id in (%s) order by %s' % (','.join(fields_pre2 + ['id']), self._table, ','.join([str(x) for x in ids]), self._order)) res = cr.dictfetchall() else: