1

我想report parser在代码中使用它RML来替换方法中的产品精度get_digits

我有这个代码:

class my_report(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(my_report, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
            'precision': self.get_precision,
        })
    def get_precision(self, product):
        ...
        return precision

可能吗?

4

1 回答 1

0

对的,这是可能的。

例如,我的 .rml 文件中有以下行。我们可以直接分配任何静态值,例如

[[ formatLang(line.price_unit, digits=4) ]]
于 2015-11-25T14:25:52.057 回答