How to update and control permissions of an app and/or menu items using xml
- first of all we need to override - ir_module_category_data.xml
- locate the menu items we need to hide/show based on permissions
- create the new permissions grroups, if it requires, under new category
full code below
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record model="ir.module.category" id="category_custompermission">
<field name="name">The E-Cig Store Permissions</field>
<field name="sequence">70</field>
<field name="visible" eval="1" />
</record>
<record id="group_ecig_view_contacts_app" model="res.groups">
<field name="name">View Contacts App</field>
<field name="category_id" ref="custom_module_name.category_custompermission"/>
</record>
<record id="group_ecig_view_employees_app" model="res.groups">
<field name="name">View Employees App</field>
<field name="category_id" ref="custom_module_name.category_custompermission"/>
</record>
<record id="group_ecig_view_pos_app" model="res.groups">
<field name="name">View POS Ribbon</field>
<field name="category_id" ref="custom_module_name.category_custompermission"/>
</record>
<record id="contacts.menu_contacts" model="ir.ui.menu">
<field name="groups_id" eval="[(5,0),(4, ref('custom_module_name.group_ecig_view_contacts_app'))]"/>
</record>
<record id="hr.menu_hr_root" model="ir.ui.menu">
<field name="groups_id" eval="[(5,0),(4, ref('custom_module_name.group_ecig_view_employees_app'))]"/>
</record>
<record id="point_of_sale.pos_config_menu_catalog" model="ir.ui.menu">
<field name="groups_id" eval="[(5,0),(4, ref('custom_module_name.group_ecig_view_pos_app'))]"/>
</record>
<record id="point_of_sale.menu_point_of_sale" model="ir.ui.menu">
<field name="groups_id" eval="[(5,0),(4, ref('custom_module_name.group_ecig_view_pos_app'))]"/>
</record>
</data>
</odoo>
Top comments (0)