在 odoo12 的表单视图中隐藏 action/more 按钮
Hide action/more button in form view in odoo12
我只想隐藏 action/more 按钮而不是 odoo12 中的打印按钮。我发现一些类似的问题在 odoo12 中不起作用。
不是一个像样的答案,而是给你一个方向。
在源代码中(我的版本是 11)
odoo-11.0/addons/web/static/src/js/chrome/sidebar.js L#34
init: function (parent, options) {
this._super.apply(this, arguments);
this.options = _.defaults(options || {}, {
'editable': true
});
this.env = options.env;
this.sections = options.sections || [
{name: 'print', label: _t('Print')},
/* disable this line
{name: 'other', label: _t('Action')},
*/
];
这不仅可以删除表单视图中的操作按钮,还可以包括列表视图。
或在odoo-11.0/addons/web/static/src/xml/base.xml L#326
<t t-name="Sidebar">
<t t-foreach="widget.sections" t-as="section">
<div class="btn-group o_dropdown">
<button t-if="section.name != 'buttons'" class="o_dropdown_toggler_btn btn btn-sm dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<t t-if="section.name == 'files'" t-raw="widget.items[section.name].length || ''"/>
<t t-esc="section.label"/> <span class="caret"/>
</button>
也许您可以考虑附加一些 if-condition 用于从这些文件中删除表单视图中的操作按钮。
我只想隐藏 action/more 按钮而不是 odoo12 中的打印按钮。我发现一些类似的问题在 odoo12 中不起作用。
不是一个像样的答案,而是给你一个方向。
在源代码中(我的版本是 11)
odoo-11.0/addons/web/static/src/js/chrome/sidebar.js L#34
init: function (parent, options) {
this._super.apply(this, arguments);
this.options = _.defaults(options || {}, {
'editable': true
});
this.env = options.env;
this.sections = options.sections || [
{name: 'print', label: _t('Print')},
/* disable this line
{name: 'other', label: _t('Action')},
*/
];
这不仅可以删除表单视图中的操作按钮,还可以包括列表视图。
或在odoo-11.0/addons/web/static/src/xml/base.xml L#326
<t t-name="Sidebar">
<t t-foreach="widget.sections" t-as="section">
<div class="btn-group o_dropdown">
<button t-if="section.name != 'buttons'" class="o_dropdown_toggler_btn btn btn-sm dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<t t-if="section.name == 'files'" t-raw="widget.items[section.name].length || ''"/>
<t t-esc="section.label"/> <span class="caret"/>
</button>
也许您可以考虑附加一些 if-condition 用于从这些文件中删除表单视图中的操作按钮。