Skip to Content
Menu
This question has been flagged
1 Odpoveď
3491 Zobrazenia

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?

Avatar
Zrušiť
Autor

Thank you so much

Best Answer

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

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
1
okt 22
3873
1
júl 20
4564
2
okt 25
2904
1
sep 25
2886
3
júl 25
4216