From cafa5e785420fb3ceeb8836652c5d38ef5598fcc Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 3 Feb 2014 13:33:11 +0100 Subject: [PATCH] [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 --- openerp/osv/orm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index e7121bb4635..c8e7c92b1d8 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -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 ''