Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
3929 Представления

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.

Related Posts Ответы Просмотры Активность
0
апр. 24
1907
2
сент. 23
2425
0
дек. 19
4610
5
дек. 19
3695
0
авг. 19
4