OpenERP如何在自定义解析器中显示错误消息/警告?

时间:2016-11-24 07:09:50

标签: python openerp openerp-7 rml

我希望在自定义解析器中显示错误消息,以便在创建pdf之前停止运行。我做过研究,但不幸的是我无法找到答案。

我在下面创建了我的代码。但不幸的是,它不起作用:(

RML

  

<para style="terp_default_8_left">[[ verify_pick_list(picking.state) ]]</para>

python解析器

class test_report(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(test_report, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
            'verify_pick_list': self._verify_pick_list,
    })

   def _verify_pick_list(self, pick_status, context=None):
        if pick_status == 'pick_listed':
           raise osv.except_osv(_('Warning!'), _('You can't print this because the status is already in Pick List.'))

        return ""

希望你能帮助我!

提前致谢。

0 个答案:

没有答案