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 ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
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
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
First shot! Great. Thanks!
Hello Everyone
Suppose i want to hide CRM menu so what i done. See the Code
1) create one file in security folder [security/security.xml]
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<record id="make_invisible" model="res.groups">
<field name="name">Show Crm Menu</field>
</record>
<record model="ir.ui.menu" id="crm.crm_menu_root">
<field name="groups_id" eval="[(5,ref('make_invisible'))]"/>
</record>
</data>
</odoo>
2) then add menu in your custom created module in xml file
<menuitem id="crm.crm_menu_root" name="CRM" groups="make_invisible"/>
3) then add the security files in __manifest__.py
'depends': ['base', 'crm'],
'data': [
'security/security.xml',
'security/ir.model.access.csv',
],
'installable': True,
'auto_install': False,
'application': True,
I Hope i will help you
Thanks in Advanced
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.
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.
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
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 ?
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
0
sept 19
|
3176 | ||
|
1
jul 16
|
9244 | ||
|
2
mar 15
|
11272 | ||
|
1
mar 15
|
4212 | ||
|
3
abr 25
|
10818 |
https://youtu.be/zHPtb1SR8Sk