Search code examples
securitypermissionsodooacl

Two security groups with different permissions for the same model - Odoo


I have a model called "banner". I am trying to create a security group "custom_sales" which will only have read access to "banner". However, I want the admin user to have all access rights. This is what I'm trying: security/groups.xml:

<record model="res.groups" id="custom_sales">
    <field name="name">Custom Sales Group</field>
    <field name="users" eval="[(4, ref('base.user_admin'))]"/>
</record>

ir.model.access.csv:

access_ftrv_banner,access.ftrv.banner,model_ftrv_banner,custom_sales,1,0,0,0

This does create an access right of read only for custom sales users but the admin can no longer even view the banner model


Solution

  • first : modify security group because what you wrote will make all users in your custom group admin role (base.user_admin)

    <record model="res.groups" id="custom_sales">
        <field name="name">Custom Sales Group</field>
        <field name="users" eval="[(4, ref('base.group_user'))]"/>
    </record>
    

    second : add all access rights to admin

    access_ftrv_banner_admin,access.ftrv.banner.admin,model_ftrv_banner,base.user_admin,1,1,1,1