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

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?

アバター
破棄
著作者 最善の回答

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> 

アバター
破棄
関連投稿 返信 ビュー 活動
2
1月 22
3774
1
11月 16
4022
0
7月 16
3084
3
12月 24
13012
3
11月 24
1018