credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #05409
[Merge] lp:~credativ/ocb-server/7.0-lp1166886 into lp:ocb-server
Craig Gowing (credativ) has proposed merging lp:~credativ/ocb-server/7.0-lp1166886 into lp:ocb-server.
Requested reviews:
OpenERP Community Backports Team (ocb)
Related bugs:
Bug #1166886 in OpenERP Community Backports (Server): "BaseMode.read_group sums numeric fields unconditionally"
https://bugs.launchpad.net/ocb-server/+bug/1166886
For more details, see:
https://code.launchpad.net/~credativ/ocb-server/7.0-lp1166886/+merge/182853
--
https://code.launchpad.net/~credativ/ocb-server/7.0-lp1166886/+merge/182853
Your team credativ is subscribed to branch lp:~credativ/ocb-server/7.0-lp1166886.
=== modified file 'openerp/osv/fields.py'
--- openerp/osv/fields.py 2013-06-20 13:10:57 +0000
+++ openerp/osv/fields.py 2013-08-29 09:57:13 +0000
@@ -114,6 +114,7 @@
self.manual = manual
self.selectable = True
self.group_operator = args.get('group_operator', False)
+ self.allow_aggreation = args.get('allow_aggregation', False)
self.groups = False # CSV list of ext IDs of groups that can access this field
self.deprecated = False # Optional deprecation warning
for a in args:
@@ -177,6 +178,8 @@
_symbol_get = lambda self,x: x or 0
def __init__(self, string='unknown', required=False, **args):
+ if 'allow_aggregation' not in args:
+ args['allow_aggregation'] = True
super(integer, self).__init__(string=string, required=required, **args)
class reference(_column):
@@ -254,6 +257,8 @@
_symbol_get = lambda self,x: x or 0.0
def __init__(self, string='unknown', digits=None, digits_compute=None, required=False, **args):
+ if 'allow_aggregation' not in args:
+ args['allow_aggregation'] = True
_column.__init__(self, string=string, required=required, **args)
self.digits = digits
# synopsis: digits_compute(cr) -> (precision, scale)
=== modified file 'openerp/osv/orm.py'
--- openerp/osv/orm.py 2013-08-20 08:54:51 +0000
+++ openerp/osv/orm.py 2013-08-29 09:57:13 +0000
@@ -2654,6 +2654,7 @@
aggregated_fields = [
f for f in fields
if f not in ('id', 'sequence')
+ if fget[f]['allow_aggregation']
if fget[f]['type'] in ('integer', 'float')
if (f in self._columns and getattr(self._columns[f], '_classic_write'))]
for f in aggregated_fields:
Follow ups