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.
I'm creating a module to customise the HR module and I have added a new feature to schedule interviews for applicants. Each applicant can have many interviews, hence there's a one2many relationship between applicant and interview models. Interview model has attributes for the interview panel. In the Kanban view of applicants, I want to make the logged user to see only the records of applicants that he is assigned to interview. How can I do this?
The user (res.users) that is responsible for a particular Applicant is stored in the Responsible (user_id) field of the Applicant. Now, you need to make sure that the search views used in the menu has user_id listed in the field. Which , if you are using OpenERP 7.0, it does. Once you have the field you need to filter listed, you can default filter the records in 2 ways, both are done via Actions.
Go to Setting >> Technical >> Actions >> Window Actions menu and search for the actions whose Destination Model is hr.applicant. Choose the Action that you want to change. Open and edit it. You'll find 2 fields that you may be able to use in the Filters section: Domain Value and Context Value. For the domain Value, you need to add ['user_id', '=', user.id] into the list. For the Context Value, you need to add "search_default_user_id": uid into the dictionary. You can try to use both.
Filtering using domain will make it "permanent", meaning user cannot further change the domain from the UI. Using the context value, user can futher change (in case s/he need to search for applicants assigned to other user) the search parameter.
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: 11/12/14, 6:09 AM|
|Seen: 920 times|
|Last updated: 3/16/15, 8:10 AM|