跳至內容
選單
此問題已被標幟
2 回覆
3926 瀏覽次數

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?

頭像
捨棄
最佳答案

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!

頭像
捨棄
最佳答案

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'}])


頭像
捨棄
作者

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.

作者

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.

相關帖文 回覆 瀏覽次數 活動
0
4月 24
1902
2
9月 23
2421
0
12月 19
4609
5
12月 19
3688
0
8月 19
4