Merge pull request #506 from odoo-dev/7.0-read-duplicate-fields-mat

[MERGE] orm: avoids error when reading twice a field
This commit is contained in:
Martin Trigaux
2014-06-12 17:17:42 +02:00
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -464,7 +464,7 @@ class many2one(_column):
# 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, SUPERUSER_ID,
list(set([x for x in res.values() if isinstance(x, (int,long))])),
list(set([x for x in res.values() if x and isinstance(x, (int,long))])),
context=context))
for id in res:
if res[id] in records:
+2
View File
@@ -3694,6 +3694,8 @@ class BaseModel(object):
return []
if fields_to_read is None:
fields_to_read = self._columns.keys()
else:
fields_to_read = list(set(fields_to_read))
# all inherited fields + all non inherited fields for which the attribute whose name is in load is True
fields_pre = [f for f in fields_to_read if