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

Hi, I dont know how to change a group of a user by coding (a function will be called by a button?)

I explored that "self.env.user.has_group('group_name')" will be return True, how can I do with that?

アバター
破棄
著作者

Thank you so much

最善の回答

Hi Nedera,

You can add or remove users to/from a group as follows

group = ...your target group...
users = [...a list of users...]

#Add
group.write({'users': [(4, user.id) for user in users]})

#Remove

group.write({'users': [(3, user.id) for user in users]})

For more information see this answer: https://www.odoo.com/forum/help-1/security-60-and-4-in-openerp-89686

アバター
破棄
関連投稿 返信 ビュー 活動
1
10月 22
3252
1
7月 20
4103
1
6月 25
1882
3
7月 25
3487
1
5月 25
1616