首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何从ListView (例如Instance.web.ListView.extend)中包含(或扩展) Odoo核心函数

如何从ListView (例如Instance.web.ListView.extend)中包含(或扩展) Odoo核心函数
EN

Stack Overflow用户
提问于 2017-06-02 15:53:56
回答 1查看 670关注 0票数 4

我正在尝试重新定义一个默认的ListView函数,但它似乎不起作用,而且我们没有进入函数体。有什么建议吗?

代码语言:javascript
运行
复制
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();
}
})();
EN

Stack Overflow用户

回答已采纳

发布于 2017-06-03 06:13:03

您需要分配这个列表视图,因为扩展会创建新的小部件,因此,您需要在更改后将其设置在相同的listview中。尝尝这个。

代码语言:javascript
运行
复制
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
         },
    });
};
票数 2
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44332969

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档