Skip to content

Commit 3f3edae

Browse files
brboiPolymorphe57
authored andcommitted
wip
1 parent 0c21f5e commit 3f3edae

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

addons/mail/models/res_users.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -670,22 +670,21 @@ def _get_current_persona(self):
670670
return (self.env["res.users"], self.env["mail.guest"]._get_guest_from_context())
671671
return (self.env.user, self.env["mail.guest"])
672672

673-
def _notify_devices(self, title='Odoo', body='', force_direct_send=False, **kw):
673+
def _notify_devices(self, tag, title='Odoo', body='', force_direct_send=False):
674+
"""
675+
:param title: title of the notification
676+
:param body: body of the notification
677+
:param force_direct_send: if True, the notification is sent immediately
678+
"""
674679
self.ensure_one()
675680
devices, private_key, public_key = self.env['mail.thread']._web_push_get_partners_parameters(self.partner_id.ids)
676-
if devices:
677-
extra_data = kw.pop('data', {})
678-
data = {
679-
'author_name': self.env.ref('base.partner_root').display_name,
680-
'model': 'res.partner',
681-
'res_id': self.partner_id.id,
682-
} | extra_data
683-
payload = {
684-
'title': title,
685-
'options': {
686-
'vibrate': [100, 50, 100],
687-
'icon': '/web/static/img/odoo-icon-192x192.png',
688-
'data': data,
689-
} | kw
690-
}
691-
self.env['mail.thread']._web_push_send_notification(devices, private_key, public_key, payload=payload, force_direct_send=force_direct_send)
681+
if not devices:
682+
return
683+
payload = {
684+
'title': title,
685+
'options': {
686+
'vibrate': [100, 50, 100],
687+
'icon': '/web/static/img/odoo-icon-192x192.png',
688+
}
689+
}
690+
self.env['mail.thread']._web_push_send_notification(devices, private_key, public_key, payload=payload, force_direct_send=force_direct_send)

0 commit comments

Comments
 (0)