Odoo (hide a menu)隐藏菜单

 

1.找到定义的菜单

下面是mail模块的top菜单,显示在页面左上角的,拿它举例

<menuitem
        id="mail.mail_channel_menu_root_chat"
        name="Discuss"
        action="mail_channel_action_client_chat"
        web_icon="mail,static/description/icon.png"
        groups="base.group_user"
        sequence="1"/>

2.隐藏

有一种方法是直接在groups中写上group,对属于该组的成员可见,'base.group_user'就是对所有人可见了。然后自定义一个新的group,任何user都不属于这个组,然后修改groups等于你定义的group,这样也可以,但是不一定好用~ 需要将子菜单也用同样方法限制,才能完全隐藏top menu。

下面是更简单的规则:

那如果想操作对所有人不可见,可以修改菜单属性

    <record id="mail.mail_channel_menu_root_chat" model="ir.ui.menu">
        <field name="groups_id" eval="[(3, ref('base.group_user'))]"/>
    </record>

id是对应的,3的意思是删除关系,对'base.group_user'是不可见。

换成自定义的group也是同理。

3.eval

  • (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.
  • (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 dete 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).
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值