From 4f5537541ffa43d120cff470d39382cf943655fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 11 Jul 2012 12:46:50 +0200 Subject: [PATCH] [FIX] Unfollow: fixed method, not allowing to unsubscribe because of checking on 'mail.thread' instead of the real model name. bzr revid: tde@openerp.com-20120711104650-9mg3kbq603sz0h5a --- addons/mail/mail_thread.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 532cc8b3982..d24ab8e3f2c 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -919,13 +919,12 @@ class mail_thread(osv.Model): # Trying to unsubscribe somebody not in subscribers: returns False # if special management is needed; allows to know that an automatically # subscribed user tries to unsubscribe and allows to warn him - mail_thread_model = self.pool.get('mail.thread') - if not user_ids and not uid in mail_thread_model.message_get_subscribers(cr, uid, ids, context=context): - return False - subscription_obj = self.pool.get('mail.subscription') to_unsubscribe_uids = [uid] if user_ids is None else user_ids + subscription_obj = self.pool.get('mail.subscription') to_delete_sub_ids = subscription_obj.search(cr, uid, ['&', '&', ('res_model', '=', self._name), ('res_id', 'in', ids), ('user_id', 'in', to_unsubscribe_uids)], context=context) + if not to_delete_sub_ids: + return False return subscription_obj.unlink(cr, uid, to_delete_sub_ids, context=context) def message_subscription_hide(self, cr, uid, ids, subtype=None, context=None):