odoo - 仅在odoo11中隐藏特定模块中的“创建”按钮
问题描述
我想隐藏树视图标题中的创建和导入按钮我的 Odoo 版本是 odoo11
我尝试在我的树视图标签中使用插create="false" edit="false"
入,但它隐藏了所有按钮,我也尝试替换t-operation="after"
tot-operation="replace"
但它影响所有其他应用程序
<template xml:space="preserve">
<t t-extend="ListView.buttons">
<t t-jquery="button.o_list_button_add" t-operation="replace">
<button t-if="widget.modelName == 'hr.timeinout'" type="button" class="btn btn-primary btn-sm oe_refresh_button" accesskey="f">
Refresh List
</button>
</t>
</t>
</template>
我只想隐藏特定树视图中的“创建”和“导入”按钮谢谢
解决方案
试试这个代码来删除创建按钮:
<t t-extend="ListView.buttons">
<!-- this will hide create button for model 'hr.timeinout' -->
<t t-jquery="button.o_list_button_add" t-operation="attributes">
<attribute name="t-if">widget.modelName != 'hr.timeinout'</attribute>
</t>
<!-- this will add refresh button for model 'hr.timeinout' -->
<t t-jquery="div.o_list_buttons" t-operation="prepend">
<button t-if="widget.modelName == 'hr.timeinout'" type="button" class="btn btn-primary oe_refresh_button" accesskey="f">
Refresh List
</button>
</t>
</t>
并删除此模型的导入按钮:
<t t-extend="ImportView.import_button">
<!-- this will remove button import for model 'hr.timeinout' -->
<t t-jquery="button.o_button_import" t-operation="attributes">
<attribute name="t-if">widget.modelName != 'hr.timeinout'</attribute>
</t>
</t>
推荐阅读
- python - 在 Redshift 中创建 python UDF 时出错
- javascript - window.print() 在同一个窗口与新窗口
- tfs - 如何使用 TFS API 获取未在 2 个分支之间合并的更改集
- github - 分支策略 - 使用 gihub 进行多次发布
- java - Android 应用程序因使用“后退”按钮而崩溃
- javascript - 如何在 nodejs 和 puppeteer 之间交换数据?
- python - 使用 Python 遍历文本文件并将一组行存储在单独的数组中
- python - 试图修改 np 数组对角线
- javascript - WebSocket 连接到“ws://127.0.0.1:8888/”失败:WebSocket 打开握手超时
- xamarin - 在 Xamarin UWP 中创建包后,视频只能用语音播放,我看不到视频