Merge pull request #93 from expsa/samir-aladawi-fix-conflicts-on-message-post-function
[FIX] odex_web_app: conflicts on message_post function
This commit is contained in:
commit
ea99859dfb
|
|
@ -7,15 +7,16 @@ class MailThread(models.AbstractModel):
|
|||
|
||||
@api.returns('mail.message', lambda value: value.id)
|
||||
def message_post(self, *, message_type='notification', **kwargs):
|
||||
notification_body = kwargs.get('body', '')
|
||||
attachments = len(kwargs.get('attachment_ids', []))
|
||||
if notification_body and attachments:
|
||||
notification_body += '\n{} File(s)'.format(attachments)
|
||||
elif attachments:
|
||||
notification_body = '{} File(s)'.format(attachments)
|
||||
if self._name in ['mail.channel']:
|
||||
notification_body = kwargs.get('body', '')
|
||||
attachments = len(kwargs.get('attachment_ids', []))
|
||||
if notification_body and attachments:
|
||||
notification_body += '\n{} File(s)'.format(attachments)
|
||||
elif attachments:
|
||||
notification_body = '{} File(s)'.format(attachments)
|
||||
|
||||
partners_to_notify = self.channel_partner_ids.filtered(lambda r: r.id != self.env.user.partner_id.id)
|
||||
for employee_id in self.env['hr.employee'].sudo().search([('user_id', 'in', partners_to_notify.user_ids.ids)]):
|
||||
push_notify = employee_id.user_push_notification_web(notification_body)
|
||||
|
||||
return super(MailThread, self).message_post(message_type=message_type, **kwargs)
|
||||
partners_to_notify = self.channel_partner_ids.filtered(lambda r: r.id != self.env.user.partner_id.id)
|
||||
for employee_id in self.env['hr.employee'].sudo().search([('user_id', 'in', partners_to_notify.user_ids.ids)]):
|
||||
push_notify = employee_id.user_push_notification_web(notification_body)
|
||||
|
||||
return super(MailThread, self).message_post(message_type=message_type, **kwargs)
|
||||
Loading…
Reference in New Issue