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

Is it possible to show the Connection Lost notification from python code in V13?

I want to be able to click a button and show this notification that there is no data available.

I know it can be done from Javascript, but i am trying to show it at the click of a button. I do not wish to raise a UserError or ValidationError or a Warning...

I also tried to do,

def show_notification(self):

return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'title': _('No Information!'),
'message': 'Cannot find any data right now. Please try again later!',
'sticky': False,
}
}

but it does not do anything!

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

Hi. The answer might be a little bit late but here is the code which work for me:

(Odoo 13)

notification = {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'title': ('Your Custom Title'),
'message': 'Your Custom Message',
'type':'success', #types: success,warning,danger,info
'sticky': True, #True/False will display for few seconds if false
},
}
return notification


อวตาร
ละทิ้ง

Do you know how to call this inside a method, not as a return.

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ย. 23
2270
1
ธ.ค. 21
2700
4
พ.ค. 24
12589
1
เม.ย. 24
3230
0
พ.ย. 23
1959