DEV Community

Jeevachaithanyan Sivanandan
Jeevachaithanyan Sivanandan

Posted on

2

Odoo User Permission and groups

I was trying to add a new set of permission after technical in user profile page.

But I could not find the code in the odoo folder, all I have got is below

        <record id="user_groups_view" model="ir.ui.view">
            <field name="name">res.users.groups</field>
            <field name="model">res.users</field>
            <field name="inherit_id" ref="view_users_form"/>
            <field name="arch" type="xml">
                <!-- dummy, will be modified by groups -->
                <field name="groups_id" position="after"/>
            </field>
        </record>
Enter fullscreen mode Exit fullscreen mode

I was enthralled why I dont see any text for technical but later realized its autogenerated bu groups. So in order to create new permissions, we need to create our custom group-

In Odoo, to refer the groups category created by odoo, check this page
odoo\odoo\addons\base\data\ir_module_category_data.xml

example on how to add custom permission inside this category - odoo\addons\product\security\product_security.xml
<?xml version="1.0" encoding="utf-8"?>

<record id="group_product_pricelist" model="res.groups">
    <field name="name">Basic Pricelists</field>
    <field name="category_id" ref="base.module_category_hidden"/>
</record>

<record id="group_sale_pricelist" model="res.groups">
    <field name="name">Advanced Pricelists</field>
    <field name="category_id" ref="base.module_category_hidden"/>
    <field name="implied_ids" eval="[(4, ref('product.group_product_pricelist'))]"/>
</record>
Enter fullscreen mode Exit fullscreen mode

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay