Odoo Help

Welcome!

This community 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.

0

how to hide menus ?

By
mohsel
on 8/5/14, 8:56 AM 3,243 views

I developped custom modules that inherit from existing modules (accountig, hr, etc..) and by installing those modules, their menus appear. so I would like to hide those menus (Accounting, Human resources) from the users with keeping the rights for the users on those modules, is it possible ? how can i do it ? 

3
Alcaline
On 9/8/14, 12:02 AM

You can hide a menu using the groups in .xml:

   first create a new folder inside of your module name it as SECURITY then inside of it create and .xml file and put this one

    <record id="make_invisible" model="res.groups">

        <field name="name">Invisible</field>

    </record>

and then put the name of this .xml file in your

     _openerp_.py ->'update_xml' : ['Security/module_name.xml','module_contains_menus.xml']

after that in your menuitems add groups equals the id of your created xml file like this:
      

<menuitem name="menu1"
            id="base.menu_root"
            groups="make_invisible"
            sequence="80"/>

 

I hope this one will help.

Will this "delete" the menu only when i install the module ? and if it is so, will it be enabled if i uninstall the module ? Thanks again

mohsel
on 9/8/14, 4:48 AM

Is it required the csv file please explain step by step .How to create a security for a custom module.As per you code I can create only a field inside Access Rights tabs under users.No functionality

Odoo
on 1/13/15, 6:26 AM

First shot! Great. Thanks!

Pascal Tremblay
on 1/13/15, 7:15 AM
0

Ludo - Neobis

--Ludo - Neobis--
2387
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 8/5/14, 9:10 AM

Yes this is possible. If you made the custom XML's with the <menuitem> tags as well, just add the the groups-attribute to that tag, like so:

<menuitem id="myitem" groups="hr.hr_manager"/>

This way, only users that belong to the hr_manager group defined in the HR module will be able to see the menu. 

You can alternatively also add your own groups in your module. The syntax would not differ much, but you would not point to the original HR module for the group name.

Thank you for your answer, what i understood, in orther to hide the hr and accounting menus i will have to surcharge the xml declaration for the menus hr and accounting ?

mohsel
on 8/7/14, 5:31 AM
0

René Schuster

--René Schuster--
1560
| 5 5 8
Weinheim, Germany
--René Schuster--

Challenge Everything!

René Schuster
On 8/5/14, 9:15 AM

Add a custom xml file to your custom modules and use the delete tag.

For example for the Human Resource menu item

<delete model="ir.ui.menu" id="hr.menu_hr_root"></delete>

 

Regards.

mohsel asked if it was possible to hide the menu from a selection of people. Your solution permanently hides the menuitem from everyone, which is fine is most cases, but I think not in the case of the ts.

Ludo - Neobis
on 8/5/14, 11:22 AM

Maybe it's due to my english, but I think he wants the official menues to be hidden, while only his own menues are visible. Anyway, you are right, delete will permanently remove the menu items, not hide them.

René Schuster
on 8/6/14, 3:36 AM

Thanks René and Ludo, your are both right, in fact i will try to hide the menus, if it doesn't work, i will use René's proposition to delete them, i"ll just gonna have to be able te reinstall them

mohsel
on 8/7/14, 5:35 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/5/14, 8:56 AM
Seen: 3243 times
Last updated: 3/16/15, 8:10 AM