根据系统参数显示菜单项 odoo 15
如何根据系统参数显示/隐藏菜单项?
我有这段代码来创建菜单项,它工作正常,但我需要根据系统参数隐藏它。
<!-- this is for test, remove this after testing -->
<record id="check_qty_and_move_from_internal_customer_to_customer" model="ir.actions.server">
<field name="name">Cron Run Directly 2</field>
<field name="model_id" ref="model_kiotviet_cron"/>
<field name="binding_model_id" ref="onnet_kiotviet.model_kiotviet_cron"/>
<field name="state">code</field>
<!-- function called -->
<field name="code">model.check_qty_and_move_from_internal_customer_to_customer()</field>
</record>
<!-- this is for test, remove this after testing -->
<menuitem id="check_qty_and_move_from_internal_customer_to_customer" name="Cron Run Directly 2" parent="kiotviet_menu_root"
action="check_qty_and_move_from_internal_customer_to_customer" sequence="6"/>
有谁知道该怎么做?谢谢。
How to show/hide menu item based on system parameter?
I've this code to create menu item, and it working fine, but i need to hide it depends on system parameter.
<!-- this is for test, remove this after testing -->
<record id="check_qty_and_move_from_internal_customer_to_customer" model="ir.actions.server">
<field name="name">Cron Run Directly 2</field>
<field name="model_id" ref="model_kiotviet_cron"/>
<field name="binding_model_id" ref="onnet_kiotviet.model_kiotviet_cron"/>
<field name="state">code</field>
<!-- function called -->
<field name="code">model.check_qty_and_move_from_internal_customer_to_customer()</field>
</record>
<!-- this is for test, remove this after testing -->
<menuitem id="check_qty_and_move_from_internal_customer_to_customer" name="Cron Run Directly 2" parent="kiotviet_menu_root"
action="check_qty_and_move_from_internal_customer_to_customer" sequence="6"/>
Does anyone know how to do that? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了答案,就是:
card(menu_item_id)
返回菜单
I've found the answer, here is it:
card(menu_item_id)
return menus