[FIX] work around a read bug: false data are fetched when the same field is present multiple times as a field parameter. The solution is to make sure the list many2onefields does not contain duplicate fields (orm.py)

bzr revid: ged@openerp.com-20140403094316-kmlliqbwd14ey68p
This commit is contained in:
Gery Debongnie 2014-04-03 11:43:16 +02:00
parent 9d8fa4d720
commit 75b66ed77c
1 changed files with 2 additions and 1 deletions

View File

@ -2382,6 +2382,7 @@ class BaseModel(object):
many2onefields = [gb['field'] for gb in annotated_groupbys if gb['type'] == 'many2one']
if many2onefields:
data_ids = [r['id'] for r in fetched_data]
many2onefields = list(set(many2onefields))
data_dict = {d['id']: d for d in self.read(cr, uid, data_ids, many2onefields, context=context)}
for d in fetched_data:
d.update(data_dict[d['id']])
@ -2416,7 +2417,7 @@ class BaseModel(object):
return result
result = map(format_result, data)
if lazy and groupby_fields[0] in self._group_by_full:
# Right now, read_group only fill results in lazy mode (by default).
# If you need to have the empty groups in 'eager' mode, then the