コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
6614 ビュー

Hello! 


I want to show these messages but their body is empty so in the chatter appears nothing. 

I mean, model 'mail.message' with message_type = 'notification'.

How can i do it?

Thanks!

アバター
破棄
最善の回答

def send_notification(self, message):
target_user_group = self.env.ref('module.group_name')

target_users = self.env['res.users'].search(
[('groups_id', '=', target_user_group.id)]
)

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

self.message_post(body=message, message_type='notification', subtype='mail.mt_comment',
notification_ids=notification_ids)
you can do something like this here i'm getting all target users through a specific group and append notifications to them the notification will be shown in each user chat notification drop down list and also at the Discuss Home page

Hope it helped 

アバター
破棄
関連投稿 返信 ビュー 活動
1
6月 19
9081
1
2月 25
1599
2
12月 24
2584
0
11月 24
2197
3
5月 24
4817