Python 在openerp报告解析器中获取产品精度

Python 在openerp报告解析器中获取产品精度,python,openerp,rml,Python,Openerp,Rml,我想在报告解析器中获得产品精度,以便在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({

我想在
报告解析器中获得产品精度,以便在
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
可能吗?

是的,可能

例如,我在.rml文件中有下面一行。我们可以直接指定任何静态值,如

[[ formatLang(line.price_unit, digits=4) ]]
是的,这是可能的

例如,我在.rml文件中有下面一行。我们可以直接指定任何静态值,如

[[ formatLang(line.price_unit, digits=4) ]]

你试过给出答案吗?你试过给出答案吗?我想要一些像:
digits=\u function()
我想要一些像:
digits=\u function()