Reputation: 2129
Good evening all...I have created a module in which there are two kinds of user groups are there..1 is customer 2nd one is admin.. it has only one top menu. i want to hide some left-side menu items when customer logins.So what is the solution to secured erp?
Thanks in advance
Upvotes: -1
Views: 1158
Reputation: 313
Create an XML file in SECURITY folder of your module.
<record model="ir.rule" id="ir_values_my_costume_rule">
<field name="name">My Rule Name</field>
<field name="model_id" ref="model_your_model_name"/>
<field name="domain_force">[('field','operator','value'),('user_id','=',user.id)]</field>
<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>
You must pass model_ before model name in like this: model_sale_order or model_project_task.
Here in eval you can either pass True or False as per you need.
Then you need to use 'groups' attribute like this:
<menuitem action="ACTION_ID" id="NEW_MENU_ID"
parent="PARENT_MENU_ID" groups="GROUP_XML_ID"/>
After making this change in xml file,
in your __openerp__.py file ---> in your data tag make an entry for this file.
For example, data:[security/your_module_security.xml]
restart the Openerp server
Upgrade your module and check it.
Upvotes: 1