Odoo Help

Welcome!

This community 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.

1

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

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

Hi,

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

Thank You.

0
dsfairy84
On 8/19/15, 8:24 AM

Hi,

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,

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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