first, i want to get a list of users ids, and then choose randomly an id from that list
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilità
- Magazzino
- PoS
- Project
- MRP
La domanda è stata contrassegnata
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!!
Good point Ermin :)
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
Internal lottery :)
chosen = fired!
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
RegistratiPost correlati | Risposte | Visualizzazioni | Attività | |
---|---|---|---|---|
|
1
lug 21
|
4130 | ||
|
3
lug 25
|
6693 | ||
|
1
mag 25
|
1007 | ||
|
2
gen 25
|
1761 | ||
|
1
ago 24
|
1804 |
Could you be more specific? What's the purpose of that?
i want to use this in a helpdesk module to assign tasks randomly to users.