我正在尝试重新定义一个默认的ListView函数,但它似乎不起作用,我们不进入函数体。有什么建议吗?
instance.web.ListView.extend({
do_search: function (domain, context, group_by) {
console.log("We need to go deeper") // We aren't get here
this.current_min = 1;
this.groups.datagroup = new DataGroup(
this, this.model, domain, context, group_by);
this.groups.datagroup.sort = this.dataset._sort;
if (_.isEmpty(group_by) && !context['group_by_no_leaf']) {
group_by = null;
}
this.no_leaf = !!context['group_by_no_leaf'];
this.grouped = !!group_by;
// Hide the pager in grouped mode
if (this.pager && this.grouped) {
this.pager.do_hide();
}
this.grouped = false;
return this.reload_content();
}
})();
答案 0 :(得分:2)
您需要分配此列表视图,因为扩展创建新窗口小部件,因此您需要在更改后将其设置在相同的列表视图中。 试试这个。
openerp.your_module_name = function(instance) {
instance.web.ListView = instance.web.ListView.extend({
init : function() {
this._super.apply(this, arguments);
},
do_search: function (domain, context, group_by) {
//Your Custom Code
},
});
};