diff options
Diffstat (limited to 'addons/gamification/data')
| -rw-r--r-- | addons/gamification/data/goal_base.xml | 2 | ||||
| -rw-r--r-- | addons/gamification/data/goal_definition.py | 9 |
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) |
