Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
6475 Näkymät

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


Avatar
Hylkää
Paras vastaus

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


Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
huhtik. 20
2963
0
huhtik. 21
1975
1
syysk. 18
2716
1
elok. 25
3312
1
jouluk. 23
2078