【问题标题】:Raising error/warning without intteruption in odoo/python在 odoo/python 中无中断地引发错误/警告
【发布时间】:2021-08-19 16:22:24
【问题描述】:

我有一个关于错误的字符串,我只想在弹出窗口中显示它们。 一切都正确,但我不想在显示错误字符串时中断程序。 我导入了警告,except_orms 但结果是一样的。 即使返回 {'title':warn.....} 也不起作用 代码如下:

            # raise UserError(_(errorstring))
            # warnings.warn('errorstring')
            # raise Warning(_(errorstring))
            raise except_orm(_('Warning'), (_(errstring)))

是否甚至可以不中断地拥有这个窗口?

【问题讨论】:

    标签: python python-2.7 error-handling odoo


    【解决方案1】:

    如果您正在寻找更改警告消息,请尝试以下操作:

        @api.onchange('field')
        def onchange_field(self):
            return {
                    'warning': {'title': _('Warning'), 'message': _('Message needed.'),},
                }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-02
      • 2013-01-16
      相关资源
      最近更新 更多