Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3204 Zobrazení

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šit
Autor

Thank you so much

Nejlepší odpověď

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šit
Related Posts Odpovědi Zobrazení Aktivita
1
říj 22
3287
1
čvc 20
4128
1
čvn 25
1908
3
čvc 25
3508
1
kvě 25
1630