openerp-7

OpenERP 7 How to give users access to custom module in OpenERP 7?


I have developed a custom Module in OpenERP 7, My administrator user can only see this module.

1-How can I give access to normal users to my custom modules?

2-What are the steps to solve this problem.

Please give a detailed example.


Solution

  • Create a one Security folder which has below two files. For example,

    security/test_security.xml file

    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
        <data noupdate="0">
            <record model="ir.module.category" id="module_category_name_test">
                <field name="name">Management</field> 
                <field name="sequence">7</field>
            </record>
    
            <record id="group_name_test_user" model="res.groups">
                <field name="name">User</field>
                <field name="category_id" ref="module_category_name_test"/>
                <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
            </record>
    
            <record id="group_name_test_manager" model="res.groups">
                <field name="name">Manager</field>
                <field name="category_id" ref="module_category_name_test"/>
                <field name="implied_ids" eval="[(4, ref('group_name_test_user'))]"/>
                <field name="users" eval="[(4, ref('base.user_root'))]"/>
            </record>
        </data>
    </openerp>
    

    After do this Management Option show with two selection value like User and Manager in setting => Users => Access Rights => Application

    Now turn for security/ir.model.access.csv

    id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
    unique_id, test.name, model_test_name, group_name_test_user, 1,1,0,0
    unique_id, test.name, model_test_name, group_name_test_manager, 1,1,1,1
    

    test.name is a table name.

    Example of csv file, how to create? Where

    NOTE

    These two files .xml and .csv must be listed in __openerp__.py as other view files are given.