how to create new permission groups, permission category

Jeevachaithanyan Sivanandan - Jul 3 - - Dev Community

How to update and control permissions of an app and/or menu items using xml

  1. first of all we need to override - ir_module_category_data.xml
  2. locate the menu items we need to hide/show based on permissions
  3. 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>
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player