I want to configure user to be able to create and edit users but only with his own allowed companies.
If I give him:
Administration - Access Rights
he is then able to create new users, but he can also give access to companies that he himself don't have permission to use.
Can I make some Record Rules for that?
Please help
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Бухгалтерия
- Склад
- PoS
- Project
- MRP
Этот вопрос был отмечен
I managed to do this by modyfing record rule inside Access Rights group for object Companies like this:
[('id', 'in', [c.id for c in user.company_ids])]
Now everyone sees only companies that they have in company_ids field.
You may want to look at the unintended consequences of making this change.
By changing the record rule, as mentioned above, it will result in the user seeing the records for all the companies they have access to in each screen. For example, by default, Odoo displays only the records belonging to the company that is currently active for that user. If you need to see the records of a different company, you have to make it the current company by selecting it from the drop down list on the top right of the screen.
With your new condition, the user will always see the records for all the companies that they have access to, no matter which company is selected as the current company. Is this what you want ?
Not really. I still see only the records for currently active company.
You can add a domain based restriction to the Allowed Companies field on the Users form view (res.users.form) by customizing it (using view inheritance) like so:
NOTE: Please ensure that you have added all the companies you/admin need access to before you activate this view. Otherwise the same restriction will apply to your/admin's id too. In any case, you can always disable the view extension if you need to open up access again
I think this app does what you need https://apps.odoo.com/apps/modules/12.0/multicompany_groups/
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Регистрация