I wanted to send the notification to the user or group of the user, within odoo in the notification icon (near the activities) after the record is created or something is edited in the record. How can I achieve that, if anyone has done this please help me with some suggestion?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
hello Bhuwan,
To send the notification you can do like this in your code.
class name:
_inherit = 'mail.thread'
code:
self.env['mail.message'].create({'message_type':"notification",
"subtype": self.env.ref("mail.mt_comment").id,
'body': "Message body",
'subject': "Message subject",
'needaction_partner_ids': [(4, self.user_id.partner_id.id)],
'model': self._name,
'res_id': self.id,
}
will you tell me what I have to do before writing this code?
You need to define condition on which mail to be send
Can this be used in web portal to show notification to portal user ? If so, kindly let me know how?
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
})
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 12 21
|
3040 | ||
|
0
thg 3 19
|
3020 | ||
|
0
thg 3 19
|
3849 | ||
Difference in Record and Recordsets?
Đã xử lý
|
|
5
thg 2 19
|
10228 | |
|
1
thg 2 24
|
2720 |