Odoo Help

Welcome!

This community 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.

0

Restricting records on Kanban view

By
Madura
on 11/12/14, 6:09 AM 659 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?

0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 11/12/14, 6:26 AM

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.

 

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?

Madura
on 11/13/14, 12:15 AM

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.

Ivan
on 11/14/14, 3:08 AM

Your Answer

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/12/14, 6:09 AM
Seen: 659 times
Last updated: 3/16/15, 8:10 AM