如何检查 Odoo 9 qweb 报告模板中 ID 列表的长度?

How to check the length of a list of ids in Odoo 9 qweb report template?

我在 Odoo 9 中有一个报告模板,我使用它的 id 字段获取模型的记录,returns id 作为我的列表。我想检查此列表的长度并基于该列表生成我的报告模板。我如何检查那里的 ids 列表的长度并据此做出决定? 这是我获取 ID 并检查其长度的代码:

<t t-if="o.referance_ids.len() > 1">
     some code
     ....      
</t>

但是当我想打印我的报告时,出现以下错误:

QWebException: "'recuite.reference.reference' object has no attribute 'len'" while evaluating
'o.referance_ids.len() > 1'

嗨,易卜拉欣,你可以使用这个

 <t t-if="len(o.referance_ids) > 1">
        some code
    </t>

取代了

<t t-if="o.referance_ids.len() > 1">
 some code

 </t>