Remove or hide a menu item in Odoo

雨燕双飞 提交于 2019-12-05 03:44:11

问题


I have this menu item, and I want to hide or remove it.


回答1:


First create a dummy group with no users in it

<record id="make_invisible" model="res.groups">
    <field name="name">Invisible</field>
 </record>

Replace all users in the group. The eval statement here means, replace all ids in the groups_id field with the id for group make_invisible.

<record model="ir.ui.menu" id="module.menu_name">
    <field name="groups_id" eval="[(6,0,[ref('make_invisible')])]"/>
</record>

You can find more information on how the eval works here




回答2:


If you want to hide it, go to the views section of your module, find that item and edit your list of groups with users, able to see it. For example, one of my menu items down below:

 <menuitem id="tabel_menu_emp_by_division" name="Employees by division"
              parent="tabel_menu"
              action="tabel_list_emp_action_group_by_division"  sequence="5" groups="Tabel.group_manager,Tabel.group_accountant,Tabel.group_eco"/>

As we can see, only listed groups (Tabel.group_manager,Tabel.group_accountant,Tabel.group_eco) can see that menu item.

If you want to remove it, just delete it from the views section.




回答3:


if it has no sub-menus you can reuse it with your own action and name and parent

    <menuitem id="module.old_menu_id" name="your string here" parent="your_parent_menu_id" 
action="your_action_id" 
sequence="10" 
groups="your_groups_here"/>

with this way it will hide from its location and appear in your parent menu with your action




回答4:


Create a new group with no users in it and assign the menu item to this group.



来源:https://stackoverflow.com/questions/33908406/remove-or-hide-a-menu-item-in-odoo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!