0
我需要从窗体和列表视图中删除打印按钮。我尝试下面的表单视图的代码。从窗体和列表视图删除打印按钮Odoo 8
* .XML
<xpath expr="//form" position="attributes">
<attribute name="print">1</attribute>
</xpath>
* .js文件
instance.web.FormView.include({
load_form: function(data) {
this._super(data);
console.log('this',this.sidebar);
if (this.is_action_enabled('print')) {
var no_print = _.reject(this.sidebar.sections, function (item) {
return item.label === _t('Print');
});
this.sections = no_print;
}
},
});
但收到此错误:this
对象没有属性sidebar
。
注意:控制台日志打印两次,首先打印一些数据,然后打印undefined
。
只有一个模型。例如:product.product。 – KbiR
您可以使用此xml代码更轻松地删除打印“ ” 此方法将删除报告。 –
jo541