Hello All,
I have 100+ users, some users have different-different groups
How can I achive this using python script or what's the standard way to import it. ?
Thanks in Advance.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello All,
I have 100+ users, some users have different-different groups
How can I achive this using python script or what's the standard way to import it. ?
Thanks in Advance.
Hello Ankit,
based on the amount of data it depends. if you have some validation on import like duplicate data will be skip and etc.. at that time you can use python script.
1. using python script also you can import.
for eg. self.env['res.users'].create({'name': 'abc', 'login': 'abc@mail.com', 'groups_id': [(6, 0, [list of groups ids])]})
2. using odoo's import feature you can import the .csv file and assign different groups to user as per below screen you can see.
Thanks @ Mitul +1
Hi Ankit,
You can import the user details using a csv file or an excel file. When I tried importing users the last day, it was taking an unusual amount of time. So I wrote a simple python function to create users and assign correct permissions. To set the correct permissions, find the field names of the permissions you need to apply while creating the users. These field name will be like 'sel_groups_1_9_10'. Just as the name suggests, those numbers are the values which the field can take. So create a list of dictionaries, with the users and their details. For example
users = [('name': 'Test', 'login': 'test@test.com', 'email': 'test@test.com', 'password': '', 'sel_groups_1_9_10': 1), ('name': 'Employee', 'login': 'employee')]
Now iterate over this list of dictionaries and create users based on these values.
for each in list:
self.env['res.users'].create({'name': each['name'], 'login': each['email'], 'password': '',
'sel_groups_11_12': each['sel_groups_11_12'], 'sel_groups_17_18': each['sel_groups_17_18']})
This will create users with the corresponding values given in the list
Thanks @ Mihran +1
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
4
Oct 23
|
10233 | ||
|
2
Aug 22
|
7032 | ||
|
1
Oct 23
|
97 | ||
|
4
Apr 23
|
9366 | ||
|
2
Sep 21
|
2308 |