2
votes

I have created a security file as that the user who is logged in can only able to see his data. The domain force is correct and working. But from some users, while creating any lead in the crm_lead model, I am finding such error:

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.

(Document type: res. users, Operation: read). And, in some users, I am available to do create lead and generate it too. Please let me know, what am I doing wrong?

<record model="ir.module.category" id="module_management">
    <field name="name">CRM LEAD MODIFICATION</field>
    <field name="description">User access level for CRM module</field>
    <field name="sequence">3</field>
</record>

    <record id="machines_group_user" model="res.groups">

     <field name="name">CRM / User</field>
     <field name="category_id" ref="crm_partner.module_management"/>

    </record>
    <record id="machines_manager_user" model="res.groups">
        <field name="name">CRM / Manager</field>
        <field name="category_id" ref="crm_partner.module_management"/>

    </record>
    <record id="rule_machines_group_user" model="ir.rule">
     <field name="name">CRM User</field>
     <field name="model_id" ref="model_res_partner"/>
     <field name="domain_force">['|',('create_uid','=',False),('create_uid','=',user.id)]</field>

        <!-- <field name="domain_force">['|',('parent_id','=',False),('parent_id','=',user.parent_id.id),('create_uid','=',user.id)]</field> -->

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

    </record>
    <record id="hr_crm_lead manager" model="ir.rule">
        <field name="name">CRM Manager</field>
        <field name="model_id" ref="model_res_partner" />
        <field name="domain_force">[(1, '=', 1)]</field>
        <field name="groups" eval="[(4, ref('crm_partner.machines_manager_user'))]"/>
    </record>
1

1 Answers

0
votes

This error normally occurs when the record rules are not given correctly, which means it is not matching with the access rights. Uncheck the active button in the record rules to check the page loads without any errors. Domain values given should be valid and it should go along with the access rights.