Good afternoon, please tell me if there is an opportunity to refresh the page or, even better, update the owl state using websocket from python code, or existing something else method to do next thing:
Why am I asking:
def test_method(self):
# create new message in 'mail.message' model
message_vals = {
'author_id': 2, # OdooBot id
'body': '
Test message
','email_from': '"OdooBot" ',
'message_type': 'notification',
'model': 'crm.lead',
'res_id': 1, # lead id
'subject': 'Test',
}
notif_message = self.env['mail.message'].sudo().create(message_vals)
# create new notification record in 'mail.notification' model and link with created message
test_values = [{
'author_id': 2, # OdooBot id
'mail_message_id': notif_message.id,
'res_partner_id': 8, # partner id
'notification_type': 'inbox',
'notification_status': 'sent',
'is_read': False,
}]
notification = self.env['mail.notification'].sudo().create(test_values)
self.env['bus.bus']._sendone(8, 'inbox', notification)
I'm trying to send a notification to the user and it comes to him, but he will see the notification only after the page is reloaded. The actual question is what I need to do and how to ensure that the user sees the notification in real time.
Expected behavior - custom notifications are working like default system notifications
Thank you