Skip to Content
Menu
This question has been flagged
1 Atsakyti
3179 Rodiniai

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?

Portretas
Atmesti
Autorius

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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
1
spal. 22
3259
1
liep. 20
4104
1
birž. 25
1884
3
liep. 25
3487
1
geg. 25
1616