[FIX] remove previous message_post function
bzr revid: mat@openerp.com-20130417115047-whc8da29f43umpoe
This commit is contained in:
parent
cadddbdf81
commit
3cf7b78efd
|
@ -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. """
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue