问题描述
我只想在odoo12中隐藏操作/更多按钮而不是打印按钮.我发现类似的问题在odoo12中不起作用.
I want to hide only action/more button not print button in odoo12. I found some similar question its not working in odoo12.
推荐答案
这不是一个体面的答案,但却是您的指导.在源代码中(我的版本是11)
odoo-11.0/addons/web/static/src/js/chrome/sidebar.js L#34
Not a decent answer, but a direction for you.In source code(my version is 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')},
*/
];
这不仅可以删除表单视图中的操作按钮,还可以包括列表视图.
This can remove action button not only in form view, but also include list view.
或者在 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条件,以便从这些文件中删除表单视图中的操作按钮.
Maybe you can consider to attach some if-condition for removing action button in form view from these file.
这篇关于在odoo12的表单视图中隐藏动作/更多按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!