From 6e13dcb8a2d71dcdfbbb0d686f4c2dc2a48ada33 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 23 Nov 2010 15:56:54 +0200 Subject: [PATCH] orm: Return numeric uid at perm_read() when no access to res.user If a res.user belongs to a company_id that the current user has no access to, perm_read() wouldn't be able to return results (but exception). Now, just skip the uid->login resolution and return the numeric value instead. bzr revid: p_christ@hol.gr-20101123135654-bslxfv93p10216d3 --- bin/osv/orm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index f0678d91903..c4d5ad1de09 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -3206,9 +3206,11 @@ class orm(orm_template): for r in res: for key in r: r[key] = r[key] or False - if details and key in ('write_uid', 'create_uid'): - if r[key]: + if details and key in ('write_uid', 'create_uid') and r[key]: + try: r[key] = self.pool.get('res.users').name_get(cr, user, [r[key]])[0] + except Exception: + pass # Leave the numeric uid there r['xmlid'] = ("%(module)s.%(name)s" % r) if r['name'] else False del r['name'], r['module'] if uniq: