Skip to Content
Menu
This question has been flagged
2 Replies
2307 Views

I need to create about 10000 users, using plain creating (edit: creating using Python code) will mostly exceed server time limit. Is there a proper way to do that?

Avatar
Discard
Best Answer

Hello Tung,

There is also another option which is more flexible.
What you need is to prepare a users.csv 

You can use import via the odoo web service.
below the link to the quite old post - but the idea is pretty smart, I think, especially if you really want to have the control of your users, it's number and of course - data.
The example is about importing products, but it's just the switching of data model.

https://erpmoldeo.wordpress.com/2011/05/10/importing-products-with-web-services-in-openerp/

That's just a suggestion, which I would like you to know about :)

Maybe this help you at a certain moment.

WIsh you luck!

Avatar
Discard
Best Answer

I once used code to create the users and restrict several parameters,and put them in the groups I wanted, but why do you want to create so many users anyway?

Here is an example of the code:

models.execute_kw(db, uid, password, 'res.users', 'create', [
{'name': 'user_name',
'login': 'user_email', # Must be different each time
'password': 'user_password',
'new_password': 'user_password',
'sel_groups_1_9_10': 1,
'sel_groups_20_21_22': 22,
'sel_groups_35_36': 36,
'sel_groups_49_50': 50,
'sel_groups_2_3': 3,
'sel_groups_26_28': 28,
'sel_groups_44_45': 45,
'notification_type': 'inbox',
'tz': 'time_zone'}])


Avatar
Discard
Author

I'm working on a project that deals with a lot of students (the amount you expect from a real university). And I have to create users for them as well.

Author

By the way with plain creating I mean using code like yours.

Then you could just iterate using a list? And assigning them the same name and password and make them change it on their first loggin? Also you could change the server time limit (although I think it disconnects at 8 minutes regardless of whatever time you put).
If that was the case you could always use small lists to iterate, like classroom list or alphabetical surname for each letter, etc...

By the way, I don't think its going to hit server time limit, because if you keep it simple and let python handle the opperation it will be like several opperations of create user, so there shouldn't be a problem.

Related Posts Replies Views Activity
0
Apr 24
557
2
Sep 23
1138
0
Dec 19
3494
5
Dec 19
2488
0
Aug 19
4