0
我的代码没有UserError消息:Odoo没有任何错误
from openerp.tools.translate import _
from openerp.exceptions import UserError
和功能:
@api.multi
def button_in_progress(self):
for rec in self:
rec.state = 'in_progress'
test = self.test_ids.ids
test1 = len(test)
if test1 == 0:
raise UserError(_('Test test'))
return True
我登录。当我得到test1为0时,我的错误消息不会出现。另外我没有得到任何错误。什么可能是错误的?
编辑你的问题和纠正缩进? – Zety
记录'self.test_ids.ids'的值是肯定的。 – Zety
现在一切正常,谢谢!问题是因为我的缩进。 – fueggit