From 1807dadbfcd077f613c72860e924fae9826a32a4 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 4 Jul 2007 10:44:05 +0000 Subject: [PATCH] Better views in project management Improving dashboards for preoject and analytic accounts Bugfix in departments More digits in secondary unit Improvement in the ORM for reading/searching in write_date and create_date: used for base_synchro module bzr revid: fp@tinyerp.com-286d97a45b5a54d28245ce5caceb4f937405db92 --- bin/osv/orm.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index eec9a380591..a79eb7f884f 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -820,7 +820,9 @@ class orm(object): value[field] = field_value return value - def perm_read(self, cr, user, ids, context={}): + def perm_read(self, cr, user, ids, context={}, details=True): + if not ids: + return [] fields = ', p.level, p.uid, p.gid' if self._log_access: fields +=', u.create_uid, u.create_date, u.write_uid, u.write_date' @@ -834,7 +836,7 @@ class orm(object): for r in res: for key in r: r[key] = r[key] or False - if key in ('write_uid','create_uid','uid'): + if key in ('write_uid','create_uid','uid') and details: if r[key]: r[key] = self.pool.get('res.users').name_get(cr, user, [r[key]])[0] return res @@ -1525,12 +1527,17 @@ class orm(object): if not str_utf8: add_null = True else: - qu2.append(table._columns[x[0]]._symbol_set[1](x[2])) + if x[0] in table._columns: + qu2.append(table._columns[x[0]]._symbol_set[1](x[2])) if x[1]=='=like': x1 = 'like' else: x1 = x[1] - qu1.append('(%s.%s %s %s)' % (table._table, x[0], x1, table._columns[x[0]]._symbol_set[0])) + if x[0] in table._columns: + qu1.append('(%s.%s %s %s)' % (table._table, x[0], x1, table._columns[x[0]]._symbol_set[0])) + else: + qu1.append('(%s.%s %s \'%s\')' % (table._table, x[0], x1, x[2])) + if add_null: qu1[-1] = '('+qu1[-1]+' or '+x[0]+' is null)' elif x[1]=='in':