Odoo Help


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.


How to write domian filter to fetch records based on user logged in

on 6/21/13, 9:59 AM 1,648 views

How to filter records based on user logged in??

indra kurniawan
On 8/6/13, 3:10 AM

I am also trying to find ways to filter my tree view records based on user's company; previously I tried using record rules, but not applicable to my use case since the 2 separate company still needs to modify the record.

found the ways to filter tree view (override the BaseModel's search method)from this link: (how to add a functional field in the domain's view)(answers.launchpad.net/openobject-server/+question/192521)

I am going to implement it like this:

  1. from the menu action xml, set some flag in context to open tree
  2. in my overriden search method check for flag in context, if flag is set add additional domain filter from current userId
  3. if no flag found, just execute the base search without modifying domain filter
Praveen Kumar
On 8/6/13, 3:56 AM

I think it's possible through front end. apply filter or search on tree view and save the current filter and set as default for user only. It works and changeable at any time.

when user will login and click on tree view then default filter will be called. you can also Customize the filters through Advance Search.

On 6/24/13, 1:48 PM

Hi ,

There is no standard module can do this , somehow you have to create custom module to do this. I have a payroll project that do something like this ,

i.e. filter the employees for the HR clerk , select only those employee which they have right to process.

the custom procedures are as follow : 1. Save a query_id in my user table for a specific model , e.g. Employee with a section ="Admin" 2. Custom the form for the employee with user_filter using fields_view_get()

these are some guidelines .hope this can help you find out some directions.

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

2 follower(s)


Asked: 6/21/13, 9:59 AM
Seen: 1648 times
Last updated: 6/14/15, 10:31 AM