This question has been flagged
1 Reply
4852 Views

 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?

Avatar
Discard
Best Answer

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.

 

Avatar
Discard
Author

Thanks for your answer. But this would mean that there should be a direct reference to the interviewer within applicant. Currently hr.applicant only has a reference to interview object and the interviewer id is only available within this interview object. Is there any way to access this from this level? or is it absolutely necessary to have a reference to who the interviewer is directly in hr.applicant?

Can't think of a "non-development" way of doing this, but since you are developing a new module, you can add a function field to check in the hr.applicant model if the user logged in has an active (non completed) interview for that particular hr.applicant. And then use that in domain.