From aefd64e8cfe41db54588dac2c50cf2a50316cc7a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 24 Dec 2013 14:00:23 +0100 Subject: [REF] gamification: compute_code is now similar to ir.actions, cleanup code bzr revid: mat@openerp.com-20131224130023-e4gc91ell38zdtfj --- addons/gamification/data/goal_base.xml | 2 +- addons/gamification/data/goal_definition.py | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) (limited to 'addons/gamification/data') 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 @@ Mail Group Following Follow mail groups to receive news python - self.number_following(cr, uid, 'mail.group') + result = pool.get('mail.followers').search(cr, uid, [('res_model', '=', 'mail.group'), ('partner_id', '=', object.user_id.partner_id.id)], count=True, context=context) 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) -- cgit v1.2.3