From 3cf7b78efd458aa0e08f63fc561d447220c6a208 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 17 Apr 2013 13:50:47 +0200 Subject: [PATCH] [FIX] remove previous message_post function bzr revid: mat@openerp.com-20130417115047-whc8da29f43umpoe --- addons/hr/hr.py | 29 ----------------------------- addons/portal/mail_mail.py | 4 ++-- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index b3954520760..4188cbb24d0 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -280,35 +280,6 @@ class hr_employee(osv.osv): that receive the context without the wrapper. """ return self.message_unsubscribe_users(cr, uid, ids, context=context) - def message_post(self, cr, uid, thread_id, context=None, **kwargs): - """Overwrite the message_post method when using the send to my - followers screen - - When a message is sent to a hr.employee using the action - action_mail_inbox_feeds, the context is extended with res_users_id - containing the user id of the user linked to the employee and - default_res_id contains 0 (to avoid misused of the function called from - the inbox page). - In these conditions, the thread_id used to send the message is the id - of the employee instead of the res_users (or partner_id). - If several employee are linked to the same user_id, the message is - duplicated and sent to every user. - - :return: the result of message_post from mail_thread, last call if - several messages are sent. - """ - if 'res_users_id' in context: - employee_ids = self.search(cr, uid, [('user_id', '=', context['res_users_id'])], context=context) - if employee_ids: - for employee_id in employee_ids: - res = super(hr_employee, self).message_post(cr, uid, employee_id, context=context, **kwargs) - return res - else: - raise osv.except_osv(_('Warning!'), _('Your user is not linked to an employee form, which is required to send messages to your followers.')) - - # if no overwrite, send message as usual - return super(hr_employee, self).message_post(cr, uid, thread_id, context=context, **kwargs) - def get_suggested_thread(self, cr, uid, removed_suggested_threads=None, context=None): """Show the suggestion of employees if display_employees_suggestions if the user perference allows it. """ diff --git a/addons/portal/mail_mail.py b/addons/portal/mail_mail.py index 9d91f601fe1..bc4cbff1d80 100644 --- a/addons/portal/mail_mail.py +++ b/addons/portal/mail_mail.py @@ -55,7 +55,7 @@ class mail_mail(osv.Model): return super(mail_mail, self).send_get_mail_body_footer(cr, uid, mail, partner=partner, context=context) -class mail_thread_portal(osv.Model): +class mail_thread_portal(osv.AbstractModel): _inherit = 'mail.thread' @@ -65,4 +65,4 @@ class mail_thread_portal(osv.Model): anonymous_group = self.pool.get('ir.model.data').get_object(cr, SUPERUSER_ID, 'portal', 'group_anonymous') if uid in [user.id for user in anonymous_group.users]: return [] - return super(mail_thread, self).get_suggested_thread(cr, uid, removed_suggested_threads, context=context) + return super(mail_thread_portal, self).get_suggested_thread(cr, uid, removed_suggested_threads, context=context)