From: Martin Trigaux Date: Tue, 3 Jun 2014 08:48:26 +0000 (+0200) Subject: [FIX] gamification: do not group on agregated field for sum X-Git-Tag: InsPy_8.0_01~90^2~21^2~19 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=aa1165441c880f248cb4c7df23e5590a7e8a43ca;p=odoo%2Fodoo.git [FIX] gamification: do not group on agregated field for sum The read_group behaviour has changed and read_group no longer sum on the field you are grouping. Instead agregate on the field we want to sum and use no groupby. For future version, grouping on a user such as what is done in batch mode is a better way to process. --- diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py index 904e6fa..266e25a 100644 --- a/addons/gamification/models/goal.py +++ b/addons/gamification/models/goal.py @@ -333,7 +333,8 @@ class gamification_goal(osv.Model): if definition.computation_mode == 'sum': field_name = definition.field_id.name - res = obj.read_group(cr, uid, domain, [field_name], [field_name], context=context) + # TODO for master: group on user field in batch mode + res = obj.read_group(cr, uid, domain, [field_name], [], context=context) new_value = res and res[0][field_name] or 0.0 else: # computation mode = count