Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Hello. I have an ERP instance with several companies.
I wan't to set a default view filter for my custom module which will show only records from current users company.
For example a user should view only records where company_id is equal to his company. It is possible to do this?
I have tried to use something like this, but it isn't working.
filter string="My Company" name="my company" domain="[('company_id','==',[user.company_id.id])]" />
Here is the answer:
In the group of your user in settings for example : Human Ressources/Manager or Human Ressources/Emplyees in settings, if you click on it, you will find some thing named "Rules". There, you add:
object: object of your custom module
['|', ('employee_id.user_id', '=', user.id), ('employee_id.department_id.manager_id.user_id', '=', user.id)]
and then you add the group of users: Human Ressources/Manager or Human Ressources/Emplyees
i have worked with this to display for each employee only his own payslips.
It works fine
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 7/15/15, 9:29 AM|
|Seen: 869 times|
|Last updated: 7/16/15, 5:28 AM|