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.

1

User based data filtering

By
A V
on 9/7/13, 8:27 AM 2,000 views

Am looking for a method to implement the following scenario. I have an asset class which has a field location. then i have created an employee and associated it with a user account . I need to limit the access to assets to only those employees with the location similar to that of the asset. The asset tree view should only show those assets based on user location. Please suggest me an idea .?

@AV can i ask you about fnct_search ? i don't know what's the different between fnct and fnct_search, if you don't mind please give me an example .. thanks in advance

Ajeng Shilvie
on 12/30/14, 1:41 AM
2

Anas Taji

--Anas Taji--
2203
| 6 7 8
Amman, Jordan
--Anas Taji--

Skype: anas.taji-sw

Email: anas.taji@smartway-jo.com

Anas Taji
On 9/7/13, 11:39 AM

You can do it by creating a group for each location, so users of the same group can see assets in that location.

Have a look at this question, it might help..%

1

Grover Menacho

--Grover Menacho--
2523
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Systems Engineer + MBA

Grover Menacho
On 9/7/13, 1:10 PM

You can do it by domains, But you have to know really well all the fields and how you have to filter them.

You can see an example of this on Sales Module, there is a group names See Own Leads that filters sales by user, so a user that is in this group can't see other Leads.

To see how they achieve this follow these steps;

  1. You have to enable Technical Features on the user who is going to configure this. Settings>Users. Select the user who is going to have the technical features and in Access Rights enable Technical Features
  2. Refresh your browser.
  3. Go to: Settings>Security>Record Rules look for Personal Orders and see the domain: ['|',('user_id','=',user.id),('user_id','=',False)]

This is enabled for the group Sales / See Own Leads so they can see only the orders where user_id is the same as their user.id or user_id is False.

You can do something like this.

Thanks, I tried to do it using coding ... my idea is to create a functional field which returns true or false value based on the user.

  1. I created a functional field invmtr invmtr':fields.function(_get_uidmtr,method=True,string='Logged in user',multi='CC',type="boolean" ), 2.It returns the following dictionary {3: {'invmtr': False}, 4: {'invmtr': False}, 5: {'invmtr': True}, 7: {'invmtr': True}} 3.but when i try to add this functional field (just for testing) , it doesn't print any value at all
A V
on 9/8/13, 7:35 AM

I have done it using a functional field and fnct_search method . Thanks guys..!!

A V
on 9/9/13, 3:46 AM
0
dbvieira
On 10/17/16, 1:12 PM

It doesnt work on Odoo 7. By doing so to the accounts the user will be locked to create / save changes.

 

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: 9/7/13, 8:27 AM
Seen: 2000 times
Last updated: 10/17/16, 1:12 PM