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
This commit is contained in:
P. Christeas 2010-11-23 15:56:54 +02:00
parent ddb331f944
commit 6e13dcb8a2
1 changed files with 4 additions and 2 deletions

View File

@ -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: