Odoo Help


Hide menu for existing group

on 5/28/13, 7:58 AM 22,147 views

How can I hide menu item for user group, using xml? I'm find code example, what grant access for some group:

<record id="original_module.menu_id" model="ir.ui.menu">
    <field name="groups_id" eval="[(4,ref('my_new_group_id'))]"/>

But, if user group already there, how can I remove it from there?

This question has been included in the official documentation.

Omal Bastin

--Omal Bastin--
| 6 6 8
Kochi, Kerala, India
--Omal Bastin--

Swiming deep into openERP/ODOO

Omal Bastin
On 5/28/13, 8:08 AM

you can use the following example

<record id="original_module.menu_id" model="ir.ui.menu">
    <field name="groups_id" eval="[(3,ref('my_new_group_id'))]"/>

There are actually0-6 numbers for representing each job for a many2many/ one2many field

  • (0, 0, { values }) -- link to a new record that needs to be created with the given values dictionary
  • (1, ID, { values }) -- update the linked record with id = ID (write values on it)
  • (2, ID) -- remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)
  • (3, ID) -- cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)
  • (4, ID) -- link to existing record with id = ID (adds a relationship)
  • (5) -- unlink all (like using (3,ID) for all linked records)
  • (6, 0, [IDs]) -- replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)

Thanks, it's works fine for me. May be you can explain what mean '4' and '3' numbers?

on 5/28/13, 9:17 AM

I have updated my answer. please check it as correct answer, if you feel its correct. Thank you

Omal Bastin
on 5/29/13, 3:57 AM

Thank you for your help. Where did you find this information?

on 5/29/13, 4:47 AM

I havent find any online documents. i found this in the orm file openerp addons

Omal Bastin
on 6/3/13, 5:10 AM

good work Omal. thanks! that help me a lot.

on 11/7/14, 9:38 AM


Pascal Tremblay
on 1/13/15, 8:14 AM

For existing groups i can hide menu but for new group (group i created), i am unable to hide menu.

on 1/22/16, 5:51 AM
This question has been included in the official documentation.
Omi Harjani
On 11/17/16, 11:34 PM
<record id="base.menu_base_partner" model="ir.ui.menu">    <field name="groups_id" eval="[(5,ref('base.group_hidden'))]"/></record><record id="account.menu_finance" model="ir.ui.menu">    <field name="groups_id" eval="[(5,ref('base.group_hidden'))]"/></record>	<menuitem icon="terp-account" id="account.menu_finance" name="Accounting" sequence="14" action="account.open_board_account" groups="base.group_hidden"/>			<menuitem icon="terp-partner"			            id="base.menu_base_partner" name="Sales"			            sequence="1" groups="base.group_hidden"/>	<menuitem id="sales_branch.menu_branch_sale_quotation" name="Sales" groups="base.group_sales_manager"/>
This question has been included in the official documentation.
On 7/29/14, 3:29 AM


I've tried this example:

<record id="view_picking_out_form_stoking" model="ir.ui.view">
            <field name="name">stock.picking.form.stocking</field>
            <field name="model">stock.picking</field>
            <field name="inherit_id" ref="stock.view_picking_out_form"/>
            <field name="groups_id" eval="[(6,0,[ref('stoking.res_groups_fournisseur')])]"/>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <xpath expr="/form[@string='Delivery Orders']/group/group/field[@name='date']" position="attributes">
                    <attribute name="attrs">{'readonly':[('state','not in',['cancel'])]}</attribute>
                <xpath expr="/form[@string='Delivery Orders']/group/group/field[@name='min_date']" position="attributes">
                       <attribute name="attrs">{'readonly':[('state','not in',['cancel'])]}</attribute>
                <xpath expr="/form[@string='Delivery Orders']/group/group/field[@name='address_id']" position="attributes">
                       <attribute name="attrs">{'readonly':[('state','not in',['cancel'])]}</attribute>
                <xpath expr="/form[@string='Delivery Orders']/notebook/page[@string='Notes']/field[@name='note']" position="attributes">
                       <attribute name="attrs">{'readonly':[('state','not in',['cancel'])]}</attribute>


But all groups is in read only. My goal is that "res_groups_fournisseur" only is in readolny in these fields.

This question has been included in the official documentation.
wilson zauma
On 3/13/14, 5:11 PM

i like to hide a menu for one group specifity, but when i apply delete this remove all menu for all users, but i want to hide for one groups. explain: i inherit a groups to user from warehouse, but this specifity users i dont want to show menu stock out.

for example i create a new groups users. i define in MY_module_folder/security/my_security.xml

<?xml version="1.0" encoding="utf-8"?>
 <data noupdate="0">
    <record id="group_stock_manager_moseltex" model="res.groups">
        <field name="name">Almacen_mosel Encargado</field>
       <field name="implied_ids" eval="[(4, ref('stock.group_stock_manager'))]"/>
    <record id="group_stock_user_moseltex" model="res.groups">
        <field name="name">Almacen_mosel usuario</field>
        <field name="category_id" ref="base.module_category_warehouse_management"/>
        <field name="implied_ids" eval="[(4, ref('stock.group_stock_user'))]"/>

but i want to hide a menu stock out (this code put inside the my_security.xml).

 <record model="ir.ui.menu" id="menu_action_picking_tree">
 <field name="groups_id"  eval="[ref('group_stock_manager_moseltex')]" />

but this is dont work.

i try to use this code, i think that this hide the menu for the users but this is no work.

<field name="groups_id" eval="[(3, ref('group_stock_users_moseltex'))]"/>
This question has been included in the official documentation.
On 10/21/14, 9:51 AM


I want to hide my menu in Human Resources? I used that groups but it didn't work? can anyone please help me how to solve this problem thanks in advance..

Here is my code:

     <menuitem name="Human Resources"
        <menuitem id="menu_hr_main" parent="menu_hr_root" name="Human Resources" sequence="0"/>
        <menuitem id="menu_hr_configuration" name="Configuration" parent="hr.menu_hr_root" groups="base.group_hr_manager" sequence="50"/>

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

8 follower(s)


Asked: 5/28/13, 7:58 AM
Seen: 22147 times
Last updated: 2/27/17, 9:09 AM