在已创建的菜单上应用组 [英] Apply groups on already created menu

查看:42
本文介绍了在已创建的菜单上应用组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个新模块,并在该模块中的.xml文件中创建了一个组.
现在,我想将该组应用于已经在其他菜单中创建的菜单中.
那么我可以将组应用于这些菜单吗?
我不想覆盖菜单,我只想在已创建的菜单中应用组.

I have developed a new module and in that module I have created a group in .xml file.
Now I want to apply that group in menus which are already created in other menu.
So can I apply groups to those menus?
I don't want to override the menu, I just want to apply groups in already created menus.

提前谢谢.

推荐答案

通过常规的OpenERP记录更新机制将组添加到现有菜单中.实际上,您不必完全重新定义模块中的现有菜单记录,只需声明具有相同ID的<record>,而对于groups_id字段则只有一个值:

Adding a group to an existing menu is done via the normal OpenERP record update mechanism. You don't actually have to fully redefine the existing menu record in your module, you just declare a <record> with the same ID, with only a value for the groups_id field:

    <record id="original_module.menu_id" model="ir.ui.menu">
        <!-- Use the special many2many value syntax to add a child record,
             and the `ref()` method to resolve the group XML ID -->
        <field name="groups_id" eval="[(4,ref('my_new_group_id'))]"/>
    </record>

您可以在OpenERP官方插件中找到类似的示例,例如使顶级 Sales 菜单

You can find similar examples in the official OpenERP addons, such as the CRM module that makes the top-level Sales menu visible to some extra groups (l.48).

这篇关于在已创建的菜单上应用组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆