summaryrefslogtreecommitdiff
path: root/bin/osv/fields.py
diff options
context:
space:
mode:
authorFabien Pinckaers <fp@tinyerp.com>2010-09-19 11:45:18 +0200
committerFabien Pinckaers <fp@tinyerp.com>2010-09-19 11:45:18 +0200
commit8b28a3cb5e88d8a859ac2fa74f5a60ddbe3fc359 (patch)
tree8c74bddad634a51ecf7b977b8a2dc0e2c42dd3c7 /bin/osv/fields.py
parenta8aa3bba98bae3d398b09d7841b279a1ff25c89d (diff)
fix
bzr revid: fp@tinyerp.com-20100919094518-j01cwcsarlgmtv0g
Diffstat (limited to 'bin/osv/fields.py')
-rw-r--r--bin/osv/fields.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/osv/fields.py b/bin/osv/fields.py
index d35136ec9e6..0db8d9abf93 100644
--- a/bin/osv/fields.py
+++ b/bin/osv/fields.py
@@ -314,11 +314,12 @@ class many2one(_column):
obj = obj.pool.get(self._obj)
# build a dictionary of the form {'id_of_distant_resource': name_of_distant_resource}
- # uid=1 because visibility of a many2one= visibility of parent object
+ # we use uid=1 because the visibility of a many2one field value (just id and name)
+ # must be the access right of the parent form and not the linked object itself.
records = dict(obj.name_get(cr, 1, list(set(filter(None, res.values()))), context=context))
for id in res:
- if id in records:
- res[id] = (id, records[id])
+ if res[id] in records:
+ res[id] = (res[id], records[res[id]])
else:
res[id] = False
return res