Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
11 Odpowiedzi
7315 Widoki

Create user helen and lisa both belong to user group "own documents only".

Create a contact test_lisa whose salesperson is lisa.

Create a contact test_helen whose salesperson is helen.

Create a record rule to user group "user own documents only" as below:

[('user_id','=',user.id)]

But when helen login she can still see all contacts include lisa's.

I expect helen and lisa can only see contacts of her own.

For reference, when the rule swt as global, it works. when set it to user group "user own documents only", it doesn't.

Awatar
Odrzuć

paste the whole ir.rule record so that the community can help.

thanks

its not working


Hi Lbrahim

I can not add an image to the post. How to show you whole ir.rule, thank you for your response.

Najlepsza odpowiedź


**************************Remember to back up before this operation.*****************************

"res.partner.rule.private.employee" this rule is very important an dangerous .


we have some problem in this file "res.partner.rule.private.employee" in record rules.

step 1: go to developer mode 

step2:in "users and companies" menu open groups and create one group in same name:"Administration / sales own contact " and add your custom sales users to this group and create one rule by "custom name" and this text rule "['|',('user_id','=',user.id),('user_id','=',False)]" and add your custom sale user to this group.

step3:in "users and companies" menu create new group of all users and add "res.partner.rule.private.employee" to this group. attention to that ,you must add all internal users to this group without sale user. 

step 4:in technical menu open records rule and search for this "res.partner.rule.private.employee" and remove "User types/internal user" group from groups list.now you must have only one new rule by "custom name" that created in step 2.

in simple explain :i remove "res.partner.rule.private.employee" from "internal/user" and set to new group for all users except "limited users". and set one new rule by new group for limit users by this rule:"['|',('user_id','=',user.id),('user_id','=',False)]"

attention to that sale user haven't this rule in any group "res.partner.rule.private.employee" but all another users have have this rule in new group that made by you .

good luck :) 

Awatar
Odrzuć

this is worked for me,tnx lot

i use it to restrict sale's user or purchase's user access to each other information ,like customer profile or supplier profile,now sale's user couldn't see contacts that created by purchase

BUT sale module couldn't create RFQ from " sale order " because sale user must not to purchase user,

what can i do for this

Najlepsza odpowiedź

you need to change code on: res.partner.rule.private.employee

Then works

Awatar
Odrzuć
Najlepsza odpowiedź

The most likely reason is that there are other Record Rules for res.partner.  Remember that all non-global rules applying to a user will take effect (an 'OR' relationship).

For example:

The res.partner.rule.private.employee and res.partner.rule.private.group rules are used for the "private address" functionality - Private Addresses are only accessible for users in the "Access to Private Address" group and blocked for other users.  Setting those two record rules to inactive will remove that functionality, but should help you get your Record Rule working.

There may be other Record Rules, depending upon what you have installed

Awatar
Odrzuć
Najlepsza odpowiedź

Can anyone solve this problem? I am still solving this problem.

Awatar
Odrzuć

I added a suggestion above.

exactly what you said, there is a rule related to res.partner object which is set in internal user group. When I make it inactive, my rule is working. The reason is all the groups inherited the internal user group.

Najlepsza odpowiedź

Did you solve this? Im having the exact same issue.

Awatar
Odrzuć
Najlepsza odpowiedź

Hello Joe, 

try this for res.partner object and own documents group
['|',('user_id','=',user.id),('user_id','=',False)]

Note: Check any other rule is there for res.partner object from settings --> Technical --> Security --> Record Rules

Awatar
Odrzuć