diff options
| author | P. Christeas <p_christ@hol.gr> | 2010-11-23 15:56:54 +0200 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2010-11-23 15:56:54 +0200 |
| commit | 6e13dcb8a2d71dcdfbbb0d686f4c2dc2a48ada33 (patch) | |
| tree | c135e351fba05e6e4c65e3efe14930cb51b40b12 | |
| parent | ddb331f9442faa1cd8670e7267af46bce846be72 (diff) | |
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
| -rw-r--r-- | bin/osv/orm.py | 6 |
1 files 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: |
