[UPD] odex_web_app: send title in notification to the firebase
This commit is contained in:
parent
adc61b80e0
commit
15a785fcfe
|
|
@ -23,10 +23,7 @@ class HrEmployee(models.Model):
|
|||
body = json.dumps({
|
||||
"to": self.fcm_token_web,
|
||||
"direct_boot_ok": True,
|
||||
"notification": {
|
||||
"title": "Message",
|
||||
"body": notification
|
||||
}
|
||||
"notification": notification
|
||||
})
|
||||
try:
|
||||
respons = requests.post(url=url, data=body, headers=header)
|
||||
|
|
|
|||
|
|
@ -14,9 +14,20 @@ class MailThread(models.AbstractModel):
|
|||
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)
|
||||
if self.public == 'private':
|
||||
for employee_id in self.env['hr.employee'].sudo().search([('user_id', 'in', partners_to_notify.user_ids.ids)]):
|
||||
custom_title = self.channel_last_seen_partner_ids.filtered(lambda r: r.partner_id.id == employee_id.user_id.partner_id.id)
|
||||
push_notify = employee_id.user_push_notification_web({
|
||||
"title": custom_title.custom_channel_name or self.env.user.partner_id.name,
|
||||
"body": notification_body
|
||||
})
|
||||
else:
|
||||
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({
|
||||
"title": self.display_name,
|
||||
"body": notification_body
|
||||
})
|
||||
|
||||
return super(MailThread, self).message_post(message_type=message_type, **kwargs)
|
||||
Loading…
Reference in New Issue