Odoo Help


How can change group of an user when he click a button?

aneesh ATEES Infomedia Pvt Ltd
on 3/12/15, 6:50 AM 666 views


Could any body help me to change group of a user when he click a button.

Thank You.

On 8/19/15, 8:24 AM


in the method called by that button you can include following code:

userpool = self.pool.get('res.users')
userpool.write(cr, SUPERUSER_ID, [uid], {'groups_id': [A])]})
# here A will be:
# Values: (0, 0, { fields }) create
# (1, ID, { fields }) update (write fields to ID)
# (2, ID) remove (calls unlink on ID, that will also delete the relationship because of the ondelete)
# (3, ID) unlink (delete the relationship between the two objects but does not delete ID)
# (4, ID) link (add a relationship)
# (5, ID) unlink all
# (6, ?, ids) set a list of links

hope this helps,

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/12/15, 6:50 AM
Seen: 666 times
Last updated: 8/19/15, 8:24 AM