xml - Odoo 10:如何隐藏我的自定义模块的导入按钮?
问题描述
我创建了一个自定义模块,我想隐藏创建和导入按钮。直到现在我能够隐藏创建按钮,但我无法使用类似的代码隐藏我的导入按钮。下面是我的代码:
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="ListView.buttons">
<t t-jquery="button.o_list_button_add" t-operation="replace">
<t t-if="widget.model=='simcard.simcard'">
<button class="btn btn-sm btn-default sync_button" type="button">Sync</button>
</t>
</t>
<t t-jquery=".btn.btn-sm.btn-default.o_list_button_import" t-operation="replace">
<t t-if="widget.model=='simcard.simcard'">
</t>
</t>
</t>
</templates>
上面的代码隐藏了 Create 按钮,但没有隐藏 Import 按钮。我可以在代码中更改哪些内容以隐藏“导入”按钮?
解决方案
你可以像这样完成它:
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="ListView.buttons">
<t t-jquery="button.o_list_button_add" t-operation="before">
<t t-if="widget.model=='simcard.simcard'">
<t t-set="widget.options.addable" t-value="false"/>
<t t-set="widget.options.import_enabled" t-value="false"/>
<button class="btn btn-sm btn-default sync_button" type="button">Sync</button>
</t>
</t>
</t>
</templates>
推荐阅读
- sql - 如何将 COALESCE 放在 CASE WHEN 语句中?
- html - 在 iOS 上无法正确查看浮动按钮
- python - VSCode 中每个目录的不同 Python 版本/环境
- javascript - 无限期动画结束事件?
- python - Sqlalchemy 结果为以指定列为键的字典
- excel - 选择性粘贴通过循环第二次覆盖数据
- python-3.x - 有没有办法使用霍夫线检测器划定端点?
- php - 两个数组长度不等的数组组合
- angular - 在重新加载页面之前,ngrx 存储不会在另一条路线上更新
- html - 如何在 Chrome 的 HTML 中旋转 SVG 中的 Pdf.js 画布输出?