Skip to Content
Menu
This question has been flagged
1 Reply
1838 Views

In my database, I have 2 companies and three-level users.

admin level, manager level, salesperson. (Company A and Company B)

The salesperson can see all customer by the record rule : ['|',('user_id','=',user.id),('user_id','=',False)]

Manager level wants to see all customers in that particular branch by the record rule : [('company_id','in',[user.company_id.id])]

Admin level user by the reord rule : [(1,'=',1)]


But my question is that I need to hide some personal customers of admin-level from manager level user? In the above record rule, manager-level users can see all the customers in that particular company including personal customers of the admin also. 

How can I hide the personal customer of admin users?

How is it possible?





Avatar
Discard

These tips help you to get the basic idea about customization in odoo

https://learnopenerp.tumblr.com/

Best Answer

To prevent the manager seeing the customers of the System Admin account, you need a domain something like this:

['&', 

('company_id','in',[user.company_id.id]),
("user_id.id","!=",2)]

Note: In earlier versions of Odoo, the Admin account is id=1

EDIT: So you mean the Sales Administrator, not System Admin. I can't think of any way to do this without any customization.

Two suggestions to consider:   

  1. Add a new boolean field to the user profile to identify Sales Administrators and use that in the Record Rule

  2. Hard-code the Record Rule based on the User IDs of the Sales Administrators

Other people smarter than me might know how to do this in a simpler way!

Avatar
Discard
Author

But actually, in my case some set of customers are personal. Remaining all should be view by the manager. Then how can I use the above record rule? Can you please suggest any other solution?

Do you mean that some of the customers of the salesperson should be private and not visible to the manager? How to identify which are private customers?

Author

Some of the customers of admin-level users should be private and not be visible to the manager and salesperson. I don't know-how I sort this issue? Can you suggest any solution? Whether it is possible through record rule?

Added something to my answer.

Author

Thank you. Will try with it.

Related Posts Replies Views Activity
1
Mar 16
2995
2
Jul 15
3287
1
Feb 23
1226
1
Jul 17
3100
3
Nov 24
347