首页 > 解决方案 > Odoo13 - 从右上角替换 UserMenu

问题描述

我正在使用 Odoo13 CE,我想删除像文档和我的 odoo.com 这样的用户菜单。

我尝试通过继承 UserMenu 模板:


<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="0">
    <templates id="template" xml:space="preserve">
        <t t-extend="UserMenu">
            <t t-jquery="div.dropdown-menu.dropdown-menu-right" t-operation="replace">
                <div class="dropdown-menu dropdown-menu-right" role="menu">
                    <a role="menuitem" href="#" data-menu="shortcuts" class="dropdown-item d-none d-md-inline-block">Shortcuts</a>
                    <a role="menuitem" href="#" data-menu="settings" class="dropdown-item">Preferences</a>
                    <a role="menuitem" href="#" data-menu="logout" class="dropdown-item">Log out</a>
                </div>
            </t>
        </t>
    </templates>
</odoo>

我的模块结构:

{
    'name': 'Replace UserMenu.Action',
    'description': """
        Remove some UserMenu""",
    'version': '13',
    'license': 'AGPL-3',
    'author': 'Rafael',
    'website': ' ',
    'depends': [
        'base', 'web'
    ],
    'data': [
    ],
    'demo': [
    ],
    'qweb': [
        'static/src/xml/change_menu2.xml'
    ],
}

但到目前为止还没有运气。我也尝试过使用或不使用odoo标签,将模板更改为模板,但它无论如何都不起作用。我尝试重新安装模块,使用 -u、-i 和 -d 等命令,但没有成功。

我也试过这个>>> \ https://www.odoo.com/forum/help-1/question/remove-support-menu-entry-from-top-right-corner-150211

我需要添加一些JS代码或类似的东西吗?

提前致谢。

标签: xmlodoo

解决方案


尝试以这种方式扩展模板,

<?xml version="1.0" encoding="utf-8"?>
<template xml:space="preserve">
    <t t-extend="UserMenu.Actions">
        <t t-jquery="a[data-menu='documentation']" t-operation='replace'></t>
    </t>
</template>

谢谢


推荐阅读