Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
1987 Prikazi

Hi there,


I want to send push notifications to employees (like it made in "Discuss" module when you receive a message), when i create or update record of 'my.model' like this:

with registry('odoo').cursor() as cr:
env = Environment(cr, SUPERUSER_ID, {})
kw = {
​'employee_id': employee_id,
​ }
​ env['my.model'].create(kw)

Example from the internet of the notification i want : https://notificare.com/static/b353409e114416dbad07522dedc21d17/ab5a8/webpush-edge-popup-windows10.png

How can i achieve this?


Thanks!


Avatar
Opusti
Avtor Best Answer

Hi,

I need not sticky notification, but push notification. As sticky notification appears only on odoo tab in browser and not appears in the operating system, but i need to show notification to employee even if browser is minimized.

Thanks for help attempt.

Avatar
Opusti
Best Answer

Hi,


In odoo, you can send sticky notifications by using the code

def sticky_notif(self):    return {

            'type': 'ir.actions.client',

            'tag': 'display_notification',

            'params': {

                'message': _("Sample sticky notification"),

                'type': 'success',

            },

        }

The notification will be appear like



You can use different types such as  : danger, success,warning etc...


Hope it helps

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
nov. 22
4123
3
avg. 25
2250
1
maj 25
2516
1
apr. 25
3502
1
apr. 25
4334