Skip to Content
Menú
This question has been flagged
1 Respondre
3162 Vistes

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
Descartar
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
Descartar
Related Posts Respostes Vistes Activitat
1
d’oct. 22
3249
1
de jul. 20
4103
1
de juny 25
1880
3
de jul. 25
3486
1
de maig 25
1615