Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
4 Ответы
24631 Представления

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


Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Лучший ответ

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
})
Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
мая 16
3609
2
июн. 25
488
1
мар. 15
4187
2
февр. 25
4796