Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3167 Widoki

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?

Awatar
Odrzuć
Autor

Thank you so much

Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
paź 22
3251
1
lip 20
4103
1
cze 25
1882
3
lip 25
3487
1
maj 25
1616