Skip to Content
Menu
This question has been flagged
1 Reply
1234 Views

hi all seniors,

i need your expert advise, please guide is it ok or can be problematic in some cases? 

folder: security 

file name: ir_rule.xml

<odoo>

<data>

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

<field name="name">Lead (CRM) access by only self and supervisor</field>

<field name="model_id" ref="crm.lead"/>

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

<field name="groups" eval="[(4, ref('base.group_user'))]"/>

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

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

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

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

</record>

</data>

</odoo>

thanks in advance.

Avatar
Discard
Best Answer
The rule in your `ir_rule.xml` file looks logically sound for granting access to CRM leads based on ownership or supervisor relationship. However, there are a few considerations: ensure the `user_id.user_ids.supervisor` field is properly set, as incorrect relationships could cause issues. The permissions granted to the `base.group_user` group allow full access, so you might want to refine them for more granular control, especially for supervisors. Complex domain filters could impact performance, so ensure proper indexing. It's important to test the rule thoroughly across different user scenarios to ensure it behaves as expected


Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
May 24
2578
1
Nov 22
4917
2
Jul 22
3647
2
May 18
9821
2
Jul 17
6758