← Back to team overview

credativ team mailing list archive

[Merge] lp:~credativ/ocb-server/7.0-lp1210177 into lp:ocb-server

 

Craig Gowing (credativ) has proposed merging lp:~credativ/ocb-server/7.0-lp1210177 into lp:ocb-server.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1210177 in OpenERP Community Backports (Server): "openerp 7.0 read_group dont compute aggreated fields on inherits table"
  https://bugs.launchpad.net/ocb-server/+bug/1210177

For more details, see:
https://code.launchpad.net/~credativ/ocb-server/7.0-lp1210177/+merge/197190

Allow aggregation of fields from a table in _inherits
-- 
https://code.launchpad.net/~credativ/ocb-server/7.0-lp1210177/+merge/197190
Your team credativ is subscribed to branch lp:~credativ/ocb-server/7.0-lp1210177.
=== modified file 'openerp/osv/orm.py'
--- openerp/osv/orm.py	2013-11-25 12:47:17 +0000
+++ openerp/osv/orm.py	2013-11-29 13:04:31 +0000
@@ -2665,12 +2665,17 @@
             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)
+            if f in self._columns:
+                qualified_field = '"%s"."%s"' % (self._table, f)
+            elif f in self._all_columns:
+                qualified_field = self._inherits_join_calc(f, query)
+            else:
+                raise except_orm('Programming Error', 'There is no column available for %s' % (f,))
             flist += "%s(%s) AS %s" % (group_operator, qualified_field, f)
 
         gb = groupby and (' GROUP BY ' + qualified_groupby_field) or ''


Follow ups