Skip to Content
Menu
This question has been flagged
2 Replies
2735 Views

Creating a very base level user group for manufacturing activities.  I want to filter contacts to only display internal users.  


As I understand I need to create a record rule.  Technical name seems to be sel_groups_1_9_10 with 1 = Internal User.  I'm having trouble finding the corresponding field to setup a record rule.


What is the proper way to achieve this?



Avatar
Discard
Author

The current global record rule is:
['|', '|', ('partner_share', '=', False), ('company_id', 'in', company_ids), ('company_id', '=', False)]

If I change it to:
[('partner_share', '=', False)]

I get exactly what I'm looking for except of course it's global so applies to all users.

If I create a new record rule with [('partner_share', '=', False)] and apply to the target group it doesn't restrict access.

As I've read a group rule should restrict a global rule to where they intersect
https://www.odoo.com/documentation/16.0/developer/reference/backend/security.html?highlight=rulesets%20intersect

I'm clearing doing something wrong.

Author Best Answer

I'm not certain this is the best solution but seems to have worked.

I did have a premission conflict, which in retrospect seems obvious.  The internal user group was providing greater access to contacts then I want all users to have.  I updated the record rule from: 

['|', ('type', '!=', 'private'), ('type', '=', False)] 

to:

['&', '|', ('type', '!=', 'private'), ('type', '=', False), ('partner_share', '=', False)]

I then created a new record rule of:

[('partner_share', '!=', False)]

and applied to group 'Sales / User: Own Documents Only' I may find I need to apply to additional groups but still testing.  

Avatar
Discard
Best Answer

Hi,

You can write the domain as follows:  [('share', '=', False)]

Thanks

Avatar
Discard
Author

Thank you. This works well as a search filter but I can't seem to make it work as a record rule. I think I may have some access right conflicts to sort out.

Any thoughts on how best to implement it?

Author

After some more trials. The domain works perfectly if I leave it as a global rule. This might be a better solution. However, now I need to allow higher use less filtering. Any thoughts?

Related Posts Replies Views Activity
1
May 25
2448
1
Apr 25
3468
1
Apr 25
4297
1
Apr 25
1779
4
Mar 25
6885