跳至内容
菜单
此问题已终结
1 回复
6462 查看

I am trying to create private channel programmatically in Odoo12 but while creating it is giving me error that: The requested operation cant be completed due to security restrictions.

Then I tried like:

self.env['mail.channel'].sudo().create({})

Then it is creating private channel as a superuser

But problem is that when I log in into my account I am unable to view that private channels because those were created by superuser.

How to display them or how to create private channel without sudo()?


形象
丢弃
最佳答案

Hi,

You can create a private channel with your user id as a member in that channel:

self.env['mail.channel'].sudo().create({'channel_last_seen_partner_ids': [(4,self.env.user.id)]})


形象
丢弃
相关帖文 回复 查看 活动
0
4月 20
2955
0
4月 21
1970
1
9月 18
2713
1
8月 25
3305
1
12月 23
2071