Javascript Odoo-从树标题中的“新建”按钮加载表单视图

Javascript Odoo-从树标题中的“新建”按钮加载表单视图,javascript,python-2.7,odoo-10,Javascript,Python 2.7,Odoo 10,我在JS中创建了两个新按钮,并替换了模型树视图中的原始添加按钮: ListView.include({ render_buttons: function() { var self = this; this._super.apply(this, arguments) if (this.model=='account.cash'){ if (this.$button

我在JS中创建了两个新按钮,并替换了模型树视图中的原始添加按钮:

ListView.include({
        render_buttons: function() {
            var self = this;            
            this._super.apply(this, arguments)
            if (this.model=='account.cash'){
            if (this.$buttons) {
                this.$buttons.find('.o_list_button_income').on('click', this.proxy('do_new_income'))
                this.$buttons.find('.o_list_button_add').css({"display":"none"})
            }
            }
        },   

        do_new_income: function () {

            var model = new Model('account.cash');
            var self = this;        
            model.call('new_income', [[]])
使用此按钮,我尝试通过以下方法调用表单视图:

    @api.model
    def new_income(self):
        view_id = self.env.ref('account.view_cash_statement_form').id
        context = self._context.copy()
        return {
            'name': 'New income',
            'view_type': 'form',
            'view_mode': 'form',
            'views': [(view_id, 'form')],
            'res_model': 'account.cash',
            'context': context,
            'target': 'current',
            'type': 'ir.actions.act_window'
        } 
然而,这是行不通的。当我尝试从标准XML视图定义中定义的按钮在其他视图中调用此方法作为测试时,它的行为与预期一致。

model.call('new_income',[[])。然后(function(res){self.do_action(res)}

其中res是python的返回值