Odoo中文网|Odoo实施培训

标题: 重写的create方法出现死循环 [打印本页]

作者: 上海-Marty    时间: 2015-11-1 15:27
标题: 重写的create方法出现死循环
重写了create方法,如下所示。但是方法中出现了死循环,哪里出错了呢?

class test(models.Model):
    _name = 'test'
    another = fields.Char(string='somefield', size=50)

    @api.model
    def create(self, vals):
        _logger.info("creating")
        super(test, self).sudo().create(vals)


作者: Frank    时间: 2015-11-1 15:43
兄弟,你忘了return了。

@api.model
def create(self, vals):
    _logger.info("creating")
    return super(test, self).create(vals)




欢迎光临 Odoo中文网|Odoo实施培训 (http://www.chinaodoo.net/) Powered by Discuz! X3.2