Odoo Help

0

get a list of users ids

By
Karim OUBHAT
on 3/24/16, 10:37 AM 1,026 views

first, i want to get a list of users ids, and then choose randomly an id from that list

Could you be more specific? What's the purpose of that?

Ermin Trevisan
on 3/24/16, 10:56 AM

i want to use this in a helpdesk module to assign tasks randomly to users.

Karim OUBHAT
on 3/24/16, 11:15 AM
1
Ermin Trevisan
On 3/24/16, 11:50 AM

The ID of the model res.users is an integer. So you could load the list and select one using a python random function, see for example https://docs.python.org/2/library/random.html.

But maybe you would rather use the model hr.employee to make sure you choose a real employee and not admin or sales or whatever :-)

I used the random.choice() function, but it doesn't work!!

Karim OUBHAT
on 3/24/16, 12:15 PM

Good point Ermin :)

Dr Obx
on 3/24/16, 12:17 PM
0
Axel Mendoza
On 3/25/16, 9:37 PM

Better you use some another strategy instead of random selection because you could end up with overloaded users while others with nothing to do. I suggest a round robin strategy for that

0
Dr Obx
On 3/24/16, 11:16 AM

Internal lottery :)

chosen = fired!

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.

Register

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)

Stats

Asked: 3/24/16, 10:37 AM
Seen: 1026 times
Last updated: 3/25/16, 9:37 PM