【问题标题】:odoo Rml Barcode custom function call inside tag标签内的odoo Rml条码自定义函数调用
【发布时间】:2017-06-09 13:56:18
【问题描述】:

我有一个 rml 文件,用于在我的程序中生成 条形码
在那个 rml 文件中:

<barCode code='EAN13' >[[data['something'] or '']]</barCode>

是为我的文件生成 barcode 的行,它指定要生成的 barcode 必须是 ean13 格式。

但是我想根据我尝试使用的值指定代码:

<barCode code='get_code()' >[[data['ean13'] or '']]</barCode>

我在哪里:

def get_code(self, ean):
        if something.something=='some':
            return 'EAN13'
        else:
            return 'Code128'

但是由于某种原因它不起作用。

如何在 rml 中的标签inside 使用if 条件?

【问题讨论】:

  • 一个ifloop ? if 不是循环。
  • 对不起,我的意思是 if 条件

标签: python openerp barcode odoo-8


【解决方案1】:

最后,我最终创建了 2 个单独的 rml 文件,并根据我需要的值调用这些文件,如果我想生成一个 ean13 条形码,我会用

<barCode code='EAN13' >[[data]]</barCode>

如果输入 128,我会调用一个完全不同的 rml 文件

<barCode code='Code128' >[[data']]</barCode>

【讨论】:

    猜你喜欢
    • 2011-10-13
    • 1970-01-01
    • 1970-01-01
    • 2021-09-19
    • 2017-06-17
    • 2012-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多