summaryrefslogtreecommitdiff
path: root/addons/gamification/data
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2013-12-24 14:00:23 +0100
committerMartin Trigaux <mat@openerp.com>2013-12-24 14:00:23 +0100
commitaefd64e8cfe41db54588dac2c50cf2a50316cc7a (patch)
tree299863831ddc4a12ea107931b9b89e0a48f0eed7 /addons/gamification/data
parent6f5815f44de8afa6fd357dd79c7ec8cca121c357 (diff)
[REF] gamification: compute_code is now similar to ir.actions, cleanup code
bzr revid: mat@openerp.com-20131224130023-e4gc91ell38zdtfj
Diffstat (limited to 'addons/gamification/data')
-rw-r--r--addons/gamification/data/goal_base.xml2
-rw-r--r--addons/gamification/data/goal_definition.py9
2 files changed, 1 insertions, 10 deletions
diff --git a/addons/gamification/data/goal_base.xml b/addons/gamification/data/goal_base.xml
index 48dd770bbcc..5da7b86679d 100644
--- a/addons/gamification/data/goal_base.xml
+++ b/addons/gamification/data/goal_base.xml
@@ -61,7 +61,7 @@
<field name="name">Mail Group Following</field>
<field name="description">Follow mail groups to receive news</field>
<field name="computation_mode">python</field>
- <field name="compute_code">self.number_following(cr, uid, 'mail.group')</field>
+ <field name="compute_code">result = pool.get('mail.followers').search(cr, uid, [('res_model', '=', 'mail.group'), ('partner_id', '=', object.user_id.partner_id.id)], count=True, context=context)</field>
<field name="action_id" eval="ref('mail.action_view_groups')" />
</record>
diff --git a/addons/gamification/data/goal_definition.py b/addons/gamification/data/goal_definition.py
index 937168fc0a2..e16f2c7b11f 100644
--- a/addons/gamification/data/goal_definition.py
+++ b/addons/gamification/data/goal_definition.py
@@ -30,12 +30,3 @@ class gamification_goal_definition_data(osv.Model):
of a user's goal. The return definition must be a float or integer.
"""
_inherit = 'gamification.goal.definition'
-
- def number_following(self, cr, uid, xml_id="mail.thread", context=None):
- """Return the number of 'xml_id' objects the user is following
-
- The model specified in 'xml_id' must inherit from mail.thread
- """
- ref_obj = self.pool.get(xml_id)
- user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
- return ref_obj.search(cr, uid, [('message_follower_ids', '=', user.partner_id.id)], count=True, context=context)