如何覆盖这个按钮?
How to override this buttons?
当我尝试为 One2many
树添加新记录时,我有一个新的弹出窗口(如下图所示),我需要验证添加到树中的每个值,为此,我使用了 onchange 方法,但它们无法正常工作...我想重写单击 'Save & Close' 按钮时调用的方法,我尝试重写write
方法,但通过这种方式,我无法控制我想要为添加的每条记录显示的错误消息。我确信做我需要的最好方法是获取当我单击 Save & Close
方法时调用的方法的名称(换句话说,什么方法将值从弹出窗口发送到 One2many 树?)。请帮帮我!
编辑:或者我如何通过点击 Add an item
调用特定的 from(向导)???
按钮上的调用方法"Save & Close"
在模块中添加Js,然后这样做
在js文件中:
openerp.module_name = function(instance) {
var QWeb = openerp.web.qweb;
_t = instance.web._t;
instance.web.FormView.include({
load_form: function(data) {
var self = this;
this.$el.find('.oe_abstractformpopup-form-save').click(this.on_button_save);
return self._super(data);
},
on_button_save: function() {
this.dataset.index = null;
this.do_show();
console.log('Save & Close button method call...');
},
});
};
当我尝试为 One2many
树添加新记录时,我有一个新的弹出窗口(如下图所示),我需要验证添加到树中的每个值,为此,我使用了 onchange 方法,但它们无法正常工作...我想重写单击 'Save & Close' 按钮时调用的方法,我尝试重写write
方法,但通过这种方式,我无法控制我想要为添加的每条记录显示的错误消息。我确信做我需要的最好方法是获取当我单击 Save & Close
方法时调用的方法的名称(换句话说,什么方法将值从弹出窗口发送到 One2many 树?)。请帮帮我!
编辑:或者我如何通过点击 Add an item
调用特定的 from(向导)???
按钮上的调用方法"Save & Close"
在模块中添加Js,然后这样做
在js文件中:
openerp.module_name = function(instance) {
var QWeb = openerp.web.qweb;
_t = instance.web._t;
instance.web.FormView.include({
load_form: function(data) {
var self = this;
this.$el.find('.oe_abstractformpopup-form-save').click(this.on_button_save);
return self._super(data);
},
on_button_save: function() {
this.dataset.index = null;
this.do_show();
console.log('Save & Close button method call...');
},
});
};