Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
4686 Vues

In Leads TreeView and FormView, I want to allow one user group to:

- View-only all leads' records (in TreeView)

- Edit the records owned by such user group (in FormView)

I have tried to find a way by using the ir.model.access.csv or ir.rule, but could not find any way.

AFAIK, I am not able to list all leads, and at the same time: allow some leads to be view-only and some other leads to be editable.

How can I list (view-only) all the records (in TreeView) but allow some of those records to be editable?

Avatar
Ignorer
Auteur Meilleure réponse

I got the answer. It is easy to achieve this goal.

Create two record rules as follows (in your views XML file, where "group_sales_base" is the user group that the rules would be applied to):

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

    <field name="name">Personal Leads</field>

    <field ref="model_crm_lead" name="model_id"/>

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

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

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

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

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

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

</record>

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

    <field name="name">Others' Leads</field>

    <field ref="model_crm_lead" name="model_id"/>

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

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

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

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

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

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

</record> 

Avatar
Ignorer
Publications associées Réponses Vues Activité
2
janv. 22
3799
1
nov. 16
4065
0
juil. 16
3134
3
déc. 24
13053
3
nov. 24
1045