Ir al contenido
Menú
Se marcó esta pregunta

Hello,

I am using odoo v.11 . I am trying to send notification to another user and the other user should be able to view the notification by logging in his account whenever he/she wants. I have seen many techniques in different websites and tried almost everything. For example: notify_info, message_post, creating a record in mail.message but none of them worked correctly. For example if I use notify_info then the other user gets the notification but it vanishes immediately. Is there any method or technique that really works? Is there any way to do that programmatically ? 

I have also tried things mentioned here:

https://www.odoo.com/forum/help-1/question/how-to-send-a-message-programmatically-3389

But nothing works. When other user logs in his account, he sees no new messages in his inbox.

Thanks


Avatar
Descartar
Mejor respuesta

hello, do like below code.

inherit mail.thread object into your object.

and on the any action wherever you want add the code like 

@api.multi
def your_method(self):
    self.message_post(body="your message", partner_ids=<list of partner ids>)

Avatar
Descartar
Mejor respuesta

i create article about that here, hope it can solve your problem

https://www.linkedin.com/pulse/send-inbox-message-notification-specific-user-odoo-13-alvin-adji/?trackingId=I9Rr8N3mQfyA%2Bh5JAtBzsw%3D%3D

Avatar
Descartar
Mejor respuesta

Try This work with me to send an inbox message to the user

if users:
notification_ids = [(0, 0,
{
'res_partner_id': user.partner_id.id,
'notification_type': 'inbox'
}
) for user in users if users]

self.env['mail.message'].create({
'message_type': "notification",
'body': "Your Body",
'subject': "Your Subject",
'partner_ids': [(4, user.partner_id.id) for user in users if users],
'model': self._name,
'res_id': self.id,
'notification_ids': notification_ids,
'author_id': self.env.user.partner_id and self.env.user.partner_id.id
})
Avatar
Descartar
Mejor respuesta

https://www.linkedin.com/pulse/send-inbox-message-notification-specific-user-odoo-13-alvin-adji/?trackingId=I9Rr8N3mQfyA%2Bh5JAtBzsw%3D%3D

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
may 16
3607
2
jun 25
479
1
mar 15
4174
2
feb 25
4784