Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
1014 Vues

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? 


Avatar
Ignorer
Auteur

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

Auteur Meilleure réponse

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)


Avatar
Ignorer
Meilleure réponse

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

Avatar
Ignorer