跳至內容
選單
此問題已被標幟
1 回覆
4638 瀏覽次數

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
3771
1
11月 16
4012
0
7月 16
3079
3
12月 24
13002
3
11月 24
1014