跳至内容
菜单
此问题已终结
2 回复
1026 查看

Hi there,

For few days now I am experiencing issues with setting up the Record Rules correct way. 


So the plan is that each customer profile in CRM should be only visible to the user who is assigned as Sales Person. Otherwise, any other people should not see it (apart from Admins).


What's the best practical way to get this sorted via Record Rules? 


形象
丢弃
编写者

After checking logs, there is an error:

odoo.addons.base.models.ir_rule: Access Denied by record rules for operation: read on record ids: [3, 15], uid: 9, model: res.partner

编写者 最佳答案

I did that however, now when user try to access record in CRM that have any logs from other users the system is giving an error: 

Due to security restrictions, you are not allowed to access 'Contact' (res.partner) records. Records: Test Record, Administrator (id=3) User: Test Partner Account (id=9)


形象
丢弃
最佳答案

Hi,

You can add the domain_force like

<field name="domain_force">[('user_id', '=', user.id)]</field>

Example:

<record id="rule_salesperson_access_only" model="ir.rule">


        <field name="name">Salesperson Access Only</field>


        <field name="model_id" ref="base.model_res_partner"/>


        <field name="domain_force">[('user_id', '=', user.id)]</field>


        <field name="groups"


               eval="[(4, ref('sales_team.group_sale_manager'))]"/>


        <field name="perm_read" eval="True"/>


        <field name="perm_write" eval="True"/>


    </record>   


Regards

形象
丢弃