Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3170 มุมมอง

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?

อวตาร
ละทิ้ง
ผู้เขียน

Thank you so much

คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ต.ค. 22
3252
1
ก.ค. 20
4103
1
มิ.ย. 25
1882
3
ก.ค. 25
3487
1
พ.ค. 25
1616