[FIX] orm: read_group aggregates values on all columns instead of only the one of the parent model

bzr revid: mat@openerp.com-20140203123311-38rwp7tfyc08flid
This commit is contained in:
Martin Trigaux 2014-02-03 13:33:11 +01:00
parent 2a297c3b2f
commit cafa5e7854
1 changed files with 2 additions and 2 deletions

View File

@ -2670,12 +2670,12 @@ class BaseModel(object):
f for f in fields
if f not in ('id', 'sequence')
if fget[f]['type'] in ('integer', 'float')
if (f in self._columns and getattr(self._columns[f], '_classic_write'))]
if (f in self._all_columns and getattr(self._all_columns[f].column, '_classic_write'))]
for f in aggregated_fields:
group_operator = fget[f].get('group_operator', 'sum')
if flist:
flist += ', '
qualified_field = '"%s"."%s"' % (self._table, f)
qualified_field = self._inherits_join_calc(groupby, query)
flist += "%s(%s) AS %s" % (group_operator, qualified_field, f)
gb = groupby and (' GROUP BY ' + qualified_groupby_field) or ''