Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată

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


Imagine profil
Abandonează
Cel mai bun răspuns

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>)

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Cel mai bun răspuns

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
})
Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
mai 16
3783
2
iun. 25
761
1
mar. 15
4331
2
feb. 25
5051