跳至内容
Odoo 菜单
  • 登录
  • 免费试用
  • 应用程序
    财务
    • 会计
    • 发票
    • 费用
    • 电子表格 (BI)
    • 文档
    • 电子签名
    销售
    • 客户关系管理
    • 销售
    • POS 销售点管理-零售
    • POS 销售点管理 - 餐厅
    • 订阅
    • 租赁
    网站
    • 网站设计
    • 电子商务
    • 博客
    • 论坛
    • 在线客服
    • 在线学习
    供应链
    • 库存
    • 制造
    • 产品生命周期
    • 采购
    • 维护保养
    • 品控
    人力资源
    • 员工
    • 招聘
    • 休假
    • 评价
    • 内部推荐
    • 车队
    营销
    • 社媒营销
    • 电邮营销
    • 短信营销
    • 近期活动
    • 营销自动化
    • 网上调查
    服务
    • 项目管理
    • 工时单
    • 现场服务
    • 服务台
    • 排期
    • 预约
    生产力
    • 讨论
    • 批核
    • IoT物联网
    • VoIP
    • 知识库
    • WhatsApp
    第三方应用软件 Odoo 定制 Odoo云端平台
  • 行业
    零售
    • 书店
    • 服装店
    • 家具店
    • 食品杂货店
    • 五金店
    • 玩具店
    餐饮与酒店服务
    • 酒吧及酒馆
    • 餐厅
    • 快餐
    • 民宿
    • 饮品分销商
    • 酒店
    房地产
    • 房地产代理
    • 建筑师事务所
    • 建造业
    • 地产管理
    • 园艺
    • 业主协会
    咨询
    • 会计师事务所
    • Odoo合作伙伴
    • 市场推广公司
    • 律师事务所
    • 人才招聘
    • 审核 & 认证
    制造
    • 纺织
    • 金属
    • 家具
    • 食品
    • 啤酒厂
    • 企业礼品
    保健与健身
    • 体育俱乐部
    • 眼镜店
    • 健身中心
    • 健康从业者
    • 药房
    • 发型屋
    商贸服务
    • 维修人员
    • IT 硬件及支持
    • 太阳能系统
    • 鞋匠
    • 清洁服务
    • 暖通空调服务
    其他
    • 非营利组织
    • 环境机构
    • 广告牌租赁
    • 摄影服务
    • 自行车租赁
    • 软件经销商
    浏览所有行业
  • 社区
    学习
    • 教学视频
    • 文档
    • 认证
    • 培训
    • 博客
    • 播客
    赋能教育
    • 教育计划
    • Scale Up! 商业游戏
    • 参观Odoo
    获取软件
    • 下载
    • 版本对比
    • 发布
    合作
    • Github
    • 论坛
    • 近期活动
    • 翻译
    • 成为合作伙伴
    • 合作伙伴服务
    • 注册您的会计事务所
    获取服务
    • 寻找合作伙伴
    • 查找会计服务
    • 预约顾问咨询
    • 安装及推行服务
    • 客户参考
    • 支持
    • 升级
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    获取演示
  • 定价
  • 技术支持

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • 客户关系管理
  • e-Commerce
  • 会计
  • 库存
  • PoS
  • 项目
  • MRP
All apps
只限注册用戶才可与社群互动。
所有帖文 人 徽章
标签 (查看所有)
odoo accounting v14 pos v15
关于此论坛区
只限注册用戶才可与社群互动。
所有帖文 人 徽章
标签 (查看所有)
odoo accounting v14 pos v15
关于此论坛区
帮助

How to change the name of an existing menuitem?

订阅

此帖文有活动时,接收通知

此问题已终结
7 回复
55608 查看
形象
Juan Formoso Vasco

I'd like to change the label of a couple menu options. For example, I want to change the name of the main menu option Sales (crm). I know how to achieve this from the user interface, but it's better to do it through code.

I read in other posts that the only way to do this is declaring a new menuitem with the same ID of the menuitem you want to change. So, I want to change these ones (main menu option and submenu):

<menuitem name="Sales"
    id="menu_base_partner"
    groups="base.group_sale_salesman"
    sequence="20"/>
<menuitem id="base.menu_sales" parent="base.menu_base_partner" name="Sales" sequence="1" />

So I put this in my module code:

<menuitem name="My new string"
    id="menu_base_partner"
    groups="base.group_sale_salesman"
    sequence="20"/>
<menuitem id="base.menu_sales" parent="base.menu_base_partner" name="My new string" sequence="1" />

What is happening is that the top menu option "Sales" is turned into "My new string", which is correct. However, the submenu is not being changed and even more, the other submenus (which were in blue color) are being transformed in dropdown options.

If I remove the line <menuitem id="base.menu_sales" parent="base.menu_base_partner" name="My new string" sequence="1" />, the top menu option "Sales" is not being altered, and if I leave that line and add another menuitem whose parent is base.menu_sales, then both menu and submenu options are replaced well but the other submenus are being transformed in dropdown options.

Can anyone help me, please?

EDIT

I tried next code too, but nothing changed. I'm sure that the XML ID I'm using is right (I'm getting it from Configuration > User interface > Menu items)

<record model="ir.ui.menu" id="base.menu_base_partner">
     <field name="name">My New Menu Name</field>
</record>

1
形象
丢弃
Jesús Ventosinos
Jesús Ventosinos

sorry for multiple answers, you need to change id="menu_base_partner" to id="base.menu_base_partner"

Baiju KS

please let me know if that worked...??

Juan Formoso Vasco
编写者

@Jesus and @Baiju, with id="base.menu_base_partner", there are no errors but the menuitem name does not change.

形象
Niyas Raphy (Walnut Software Solutions)
最佳答案

Hi,

For changing name of an existing menu item, you can do it like this,

<record model="ir.ui.menu" id="sales_team.menu_sale_config">
<field name="name">Configuration</field>
</record>

Refer:  How To Inherit Menu Item And Make Changes in Odoo

Thanks

3
形象
丢弃
Zahtoot

those 2 methodes mentioned in the video are not working on odoo 18 any solutions

形象
Marvin Taboada
最佳答案

Hello Juan, menu entries are stored as records of the 'ir.ui.menu' object type, so it is possible to use 'record' XML tags to update 'ir.ui.menu' records by providing 'model' and 'id' attributes to identify the existing record. E.g. Project>Configuration (source here):

    <record model="ir.ui.menu" id="mod_id.menu_id">
      <field name="name">My New Menu Name</field>
    </record>

'record' XML tags are processed differently, so you only require to provide fields/values for anything you want to modify.

Regards,
Marvin

Edit: I created a simple module 'hr_menu_mv' to shorten the top level "Human Resources" menu to "HR", just to verify this approach, below are sources for the three files required (verified with v7.0 and v8.0):

__init__.py:

# empty as no python modules are required to be imported

__openerp__.py:

{
    'name': "HR Menu Mv",
    'version': "0.1",
    'category': "Human Resources",
    'depends': ['hr'],
    'data': ['hr_menu_mv_view.xml'],
    'installable': True,
    'auto_install': False,
    'application': False,
}

hr_menu_mv_view.xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record model="ir.ui.menu" id="hr.menu_hr_root">
            <field name="name">HR</field>
        </record>
    </data>
</openerp>

I'm omitting translations just to keep the example small and readable.

4
形象
丢弃
Juan Formoso Vasco
编写者

This is the way I like the most, but nothing happened. I tried this: My New Menu Name --- I am sure that the XML ID of the menu I want to change is that one (base.menu_base_partner), because I am looking for it in Configuration > User interface > Menu items. I am writing that code from my customized module. Do you see anything wrong?

Juan Formoso Vasco
编写者

I am sorry, I always forget that when I paste XML tags in a comment, these ones dissapear, so I am going to edit the question so you can check what I did.

Juan Formoso Vasco
编写者

Thank you for your patience Marvin. I did exactly what you did: I created a new module with your lines (for v7) However, nothing happened again. In my case, the XML ID of the main menu option of Human Resources is "hr.menu_hr_main". I tried with both, but still nothing. I restarted and updated the service and then pressed F5. No results.

Marvin Taboada

Juan, I have verified that the "base.menu_base_partner" menu entry is defined four time in v7.0 sources, once in the "base" module, and then three times in the following modules: "crm", "crm_helpdesk", "sale". If you're using any of the previous modules, chances are that your entry (either 'record' or 'menuitem') that renames "base.menu_base_partner" is not applied last (so it gets renamed to Sales again). In order to guarantee that your changes are applied last, you can declare module dependencies to any other modules that rename "base.menu_base_partner" ("crm", "crm_helpdesk", "sale") so your module will be installed after all of them.

Juan Formoso Vasco
编写者

One minute! I have just checked my database and the record name for that menu was changed well, as you said! But for one reason I can't see the changes in the browser.

Juan Formoso Vasco
编写者

I'm racking my brains to know why I can't see the changes on the browser, I tried a lot of things, but still nothing. One thing is clear: the code you gave me is changing my database, and it's working for you, so your answer is right. I will open another question to ask about my other problem, but this one is solved. Thank you a lot for your patience, Marvin.

Juan Formoso Vasco
编写者

I had to synchronize terms to see the changes: https://www.odoo.com/forum/help-1/question/why-cant-i-see-changes-made-on-the-table-ir-ui-menu-trying-to-change-a-menuitem-67732

iWesabe Technologies

+1

形象
Baiju KS
最佳答案

Try this:-

<menuitem name="New String"
    id="sale.menu_base_partner"
    groups="base.group_sale_salesman"
    sequence="20"/>

3
形象
丢弃
Juan Formoso Vasco
编写者

Thank you! But that does not work, I get the next error: AssertionError: The ID "sale.menu_base_partner" refers to an uninstalled module. In fact, the menu I want to change is "base.menu_base_partner" (I can see it trough the OpenERP interface).

形象
Jesús Ventosinos
最佳答案

if you want to override a id youn need to set the complete id module.id

0
形象
丢弃
形象
Soporte Jocaagura
最佳答案

Do not forget insert into

<data noupdate="0">
<record model="ir.ui.menu" id="hr.menu_hr_root">
    <field name="name">HR</field>
<!-- in 11 version -->
    <field name="complete_name">HR</field>
</record>
</data>

to force the update of registry and CTRL+f5 in web browser to update the display name

0
形象
丢弃
形象
Xabier Arrabal Amat
最佳答案

I had the same problem, after trying all the methods none worked. Finally I realized that there was a translation problem as the menuitem name term was already translated, therefor although the changes were made correctly they were not visible. Check out the tranlsation terms to check if your menu name is already there. The method I finally used was: 

<menuitem name="Sales"
id="account.menu_finance_receivables"
parent="account.menu_finance"
sequence="2"/>
0
形象
丢弃
形象
Billiard R Made
最佳答案

Using an SQL Manager I would open ir_ui_menu and ir_ui_menu_group_rel and delete all records related to this particular Menu. Then ammend my template and update

Try code below. Paying attantion to my bold text. The two must be exact. If you put base.menu_base_partner on the first one then the bottom one must also be base.menu_base_partner

<menuitem name="My new string"
    id="menu_base_partner"
    groups="base.group_sale_salesman"
    sequence="20"/>
<menuitem id="base.menu_sales" parent="menu_base_partner" name=
"My new string" sequence="1" />

-1
形象
丢弃
Atchuthan - Technical Consultant, Sodexis Inc

@Billiard, This is a wrong methodology. When you delete the record directly using SQL manager, the corresponding menus are removed. But when you update your database using -u all command, then you will have multiple menus (old+newly created menu)

喜欢讨论吗?不要只阅读,加入进来!

立即创建账户,享受专属功能,与我们的精彩社区互动!

注册
社区
  • 教学视频
  • 文档
  • 论坛
开源
  • 下载
  • Github
  • Runbot
  • 翻译
服务
  • Odoo.sh 托管
  • 支持
  • 升级
  • 自定义开发服务
  • 教育
  • 查找会计服务
  • 寻找合作伙伴
  • 成为合作伙伴
关于我们
  • 我们的公司
  • 品牌资产
  • 联系我们
  • 招聘
  • 近期活动
  • 播客
  • 博客
  • 客户
  • 法律 • 隐私
  • 安全
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo致力于为企业管理提供高效智能的开源解决方案,是全球业内高速成长的软件服务商之一,逾七百五十万用户选择Odoo进行数字化升级。通过一系列全业务链覆盖、高度集成、简单易用的商业应用,助力企业实现信息化改革、降本增效并释放公司增长潜力。

Odoo独特的价值在于是一款非常容易使用又完全集成的应用。

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now