This question has been flagged
3 Replies
16619 Views

I have 2 user group in my custom module.
example


<record model="ir.module.category" id="module_category_dsr">

        <field name="name">DSR</field>

        <field name="sequence">11</field

</record>


record id="group_dsr_manager" model="res.groups">
    <field name="name">Manager</field>
    <field name="category_id" ref="lmc_crm.module_category_dsr"/>
    <field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>

<record id="group_dsr_user" model="res.groups">
    <field name="name">User</field>
    <field name="category_id" ref="lmc_crm.module_category_dsr"/> 

</record>

in ir.ui.model.security I set perm_read is 0.That time administrator can delete the records.Other users can't.

Question

How to set the only manager have to permission to delete records in this module?

Avatar
Discard

Group and Access Rights in Odoo: https://goo.gl/4jAhtH

Best Answer

Hi,

For this you can add a access control/ csv like this,

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
id_for_the_manager_access,manager_record_name,module_name.model_name,manager_group_name,1,1,1,1
id_for_the_user_access_record,user_record_name,module_name.model_name,user_group_name,1,1,1,0

Add this file in Security folder and give it in manifest file

Thanks

Avatar
Discard
Author

Thanks niyas

Best Answer

The most significant area in Odoo/OpenERP is how to deal or manage users. Managing users and assigning groups or role is the key point in every business. In Odoo/OpenERP assigning role or group to the single user is made through Administrator. And its not a good practice to do so using login through admin and do some setting stuff like assigning groups to employee or users.

After assigning groups to individual users you may need to set access controls. Defining access control is what your users have right to do with your data. Remember access control belongs to your object. There are four type of Access Control List (ACL) in Odoo/ERP.

  1. Read access: members of the group can read the data in the object,

  2. Create access: members of the group can create a new record in the object,

  3. Write access: members of the group can modify the contents of records in the object,

  4. Delete access: members of the group can delete records from the object.

"access_controll_list_id","title/name of your ACL","model_your_model_name_goes_here","module_name.group_name_goes_here",1,1,1,1

Read more in detail: http://learnopenerp.blogspot.com/2018/01/groups-and-access-rights-in-odoo.html

Avatar
Discard