Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
13420 มุมมอง

I have setup the odoo CRM for my organization. but when any of my sales person add new contact it is visible to other sales person as well. what should i do to restrict sales person to see his own contacts only. But admin should see all sales person contact. 

I have applied below rules but it can restrict admin as well to see his own contact. instead to see all contacts.

['|',('create_uid','=',user.id),'|',('id','=',1),('id', '=', user.partner_id.id)]


Can any one help me out to resolve this?

อวตาร
ละทิ้ง

Where do I apply this fix to? The one Cybrosis wrote I mean, Like where do I paste the code for it to work

คำตอบที่ดีที่สุด

Hi,

If you need salespersons to see only see their own customers, you can write a record rule for the model res.partner as follows.

<record model="ir.rule" id="partner_view_rule_salesperson">
<field name="name">Sales Person View Rule</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="groups" eval="[(4, ref('sales_team.group_sale_salesman'))]" />
<field name="domain_force">[('user_id', '=', user.id)]</field>
</record>

For the Managers,

<record model="ir.rule" id="partner_view_rule_manager">
<field name="name">Sales Person View Rule</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="groups" eval="[(4, ref('sales_team.group_sale_manager'))]" />
<field name="domain_force">[(1, '=', 1)]</field>
</record>


Thanks


อวตาร
ละทิ้ง

Hi!

Which file I need to change to do that?

Have a Question:

I want to show user all employees but also want that he can edit his own record from that ?

คำตอบที่ดีที่สุด

Hello, I'm using Odoo 16, but the following Rules makes no effect.

How should I restrict contant visablitiy for specific users in Odoo 16?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You can create Record Rules by enabling Developer Mode and navigating to Technical / Record Rules.

The object is Contact (res.partner), the rule definition is the domain, and the group is the one used by the sales people. 


The second record rule is applied to the Sales Administrator role.

It's a good idea to check all the Record Rules for Contacts, because this can become complex.

https://odootricks.tips/record-rules

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
CRM, res_partner and fields แก้ไขแล้ว
2
มิ.ย. 25
1531
1
ก.ย. 24
3515
1
ส.ค. 24
1777
1
ส.ค. 24
2031
0
ส.ค. 24
252