如何在odoov8中显示记录条目计数one2many字段视图

时间:2016-12-20 06:43:27

标签: xml python-2.7 openerp

One2Many和Many2Many如果记录小于80,则树视图计数不可见。并且所有情况下都需要树视图计数。 请任何一个帮助。

1 个答案:

答案 0 :(得分:0)

它的代码工作正常。请试试这个解决方案,谢谢你

路径:附加元件/网络/静态/ SRC / JS / view_list.js

电流:

configure_pager: function (dataset) {
    this.dataset.ids = dataset.ids;
    // Not exactly clean
    if (dataset._length) {
        this.dataset._length = dataset._length;
    }

    var total = dataset.size();
    var limit = this.limit() || total;
    if (total === 0)
        this.$pager.hide();
    else
        this.$pager.css("display", "");
    this.$pager.toggleClass('oe_list_pager_single_page', (total <= limit));
    var spager = '-';
    if (total) {
        var range_start = this.page * limit + 1;
        var range_stop = range_start - 1 + limit;
        if (this.records.length) {
            range_stop = range_start - 1 + this.records.length;
        }
        if (range_stop > total) {
            range_stop = total;
        }
        spager = _.str.sprintf(_t("%d-%d of %d"), range_start, range_stop, total);
    }

    this.$pager.find('.oe_list_pager_state').text(spager);
},

更改代码:

configure_pager: function (dataset) {
    this.dataset.ids = dataset.ids;
    // Not exactly clean
    if (dataset._length) {
        this.dataset._length = dataset._length;
    }
    if (this.$pager) {
        if (this.grouped) {
            // page count is irrelevant on grouped page, replace by limit
            this.$pager.find('.oe-pager-buttons').hide();
            this.$pager.find('.oe_list_pager_state').text(this._limit || '∞');
        } else {
            var total = dataset.size();
            var limit = this._limit || total;
            this.$pager.find('.oe-pager-buttons').toggle(total > limit);
            this.$pager.find('.oe_pager_value').toggle(total !== 0);
            var spager = '-';
            if (total) {
                var range_start = this.page * limit + 1;
                var range_stop = range_start - 1 + limit;
                if (this.records.length) {
                    range_stop = range_start - 1 + this.records.length;
                }
                if (range_stop > total) {
                    range_stop = total;
                }
                spager = _.str.sprintf(_t("%d-%d of %d"), range_start, range_stop, total);
            }

            this.$pager.find('.oe_list_pager_state').text(spager);
        }
    }
},