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