Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2208 มุมมอง

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!


อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
How can I use Enterprises module ? แก้ไขแล้ว
1
พ.ย. 22
4347
3
ส.ค. 25
2805
1
พ.ค. 25
2752
1
เม.ย. 25
3723
1
เม.ย. 25
4582