Odoo Help


How do I let all users see all leads (read only) but edit only the leads in the user group they belong to (read / write) ?

Ossama Gharib
on 8/6/15, 12:38 PM 876 views

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?

Ossama Gharib
On 8/19/15, 5:35 AM

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 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"/>


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/6/15, 12:38 PM
Seen: 876 times
Last updated: 8/19/15, 10:21 AM