Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
3196 Vistas

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

Mejor respuesta

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
Publicaciones relacionadas Respuestas Vistas Actividad
1
oct 22
3280
1
jul 20
4122
1
jun 25
1893
3
jul 25
3497
1
may 25
1621