Odoo 10 - Javascript - ListView 按钮操作不起作用

Odoo 10 - Javascript - ListView button action not working

我正在使用 Odoo 10。

我在 ListView.buttons 中添加了一个按钮,但我无法对其进行 link 操作。

我的按钮:

<t t-extend="ListView.buttons">
    <t t-jquery="button.o_list_button_add" t-operation="after">
        <t t-if="widget.fields_view.name == 'site.tree'">
            <button type="button" class="btn btn-primary btn-sm oe_create_customer_button">
                Create Customer Site
            </button>
        </t>
    </t>
</t>

js代码:

openerp.broadband = function(instance, local) {

instance.web.ListView.include({
    render_buttons: function() {
        this._super.apply(this, arguments)
        if (this.$buttons) {
            this.$buttons.find('.oe_create_customer_button').on('click', this.proxy('do_new_button'))
        }
    },
    do_new_button: function () {
        this.do_action({
            type: 'ir.actions.act_window',
            name: 'site_wizard_act_js',
            res_model: 'broadband.wizard',
            view_type: 'form',
            view_mode: 'form',
            view_id: 'site_wizard_act',
            target: 'new',
        })
    }
})
}

但是当我点击按钮时 Odoo 给了我'TypeError: this.view_order[0] is undefined'

有人可以帮助我吗?

谢谢。

[已解决]

我在操作中添加了 'context''views' 参数。

instance.web.ListView.include({
    render_buttons: function() {
        this._super.apply(this, arguments)
        if (this.$buttons) {
            this.$buttons.find('.oe_create_customer_button').on('click', this.proxy('do_new_button'))
        }
    },
    do_new_button: function () {
        var context = {
            'id': this.id,
        }
        var action = ({
            type: 'ir.actions.act_window',
            res_model: 'broadband.wizard',
            view_type: 'form',
            view_mode: 'form',
            views: [[false, 'form']],
            target: 'new',
            context: context
        })
        this.do_action(action)
    }
})