diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py index ecb4c495d94..a6c467f0177 100644 --- a/addons/gamification/models/challenge.py +++ b/addons/gamification/models/challenge.py @@ -355,10 +355,13 @@ class gamification_challenge(osv.Model): if write_op: self.write(cr, uid, [challenge.id], {'user_ids': write_op}, context=context) - if to_remove_ids: - self.message_unsubscribe_users(cr, uid, [challenge.id], to_remove_ids, context=None) - if to_add_ids: - self.message_subscribe_users(cr, uid, [challenge.id], to_add_ids, context=context) + if challenge.report_message_frequency != 'never': + if to_remove_ids: + self.message_unsubscribe_users(cr, uid, [challenge.id], to_remove_ids, context=context) + if to_add_ids: + self.message_subscribe_users(cr, uid, [challenge.id], to_add_ids, context=context) + else: + self.message_unsubscribe_users(cr, uid, [challenge.id], old_user_ids, context=context) return True diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py index af9a763236d..7fcf8e5f981 100644 --- a/addons/gamification/models/goal.py +++ b/addons/gamification/models/goal.py @@ -138,7 +138,6 @@ class gamification_goal(osv.Model): _name = 'gamification.goal' _description = 'Gamification goal instance' - _inherit = 'mail.thread' def _get_completion(self, cr, uid, ids, field_name, arg, context=None): """Return the percentage of completeness of the goal, between 0 and 100""" @@ -226,8 +225,7 @@ class gamification_goal(osv.Model): temp_obj = self.pool.get('email.template') template_id = self.pool['ir.model.data'].get_object(cr, uid, 'gamification', 'email_template_goal_reminder', context) body_html = temp_obj.render_template(cr, uid, template_id.body_html, 'gamification.goal', goal.id, context=context) - - self.message_post(cr, uid, goal.id, body=body_html, partner_ids=[goal.user_id.partner_id.id], context=context, subtype='mail.mt_comment') + self.pool['mail.thread'].message_post(cr, uid, 0, body=body_html, partner_ids=[goal.user_id.partner_id.id], context=context, subtype='mail.mt_comment') return {'to_update': True} return {} diff --git a/addons/gamification/views/goal.xml b/addons/gamification/views/goal.xml index 528d5db0511..884467404ce 100644 --- a/addons/gamification/views/goal.xml +++ b/addons/gamification/views/goal.xml @@ -86,10 +86,6 @@ -
- - -