コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
1022 ビュー

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

アバター
破棄