[英]How to check the length of a list of ids in Odoo 9 qweb report template?
I have a report template in Odoo 9 and I get records of a model using it's id field, which returns the ids as list for me. 我在Odoo 9中有一个报告模板,并且使用它的id字段获取模型的记录,该记录为我返回id作为列表。 I want to check the length of this list and based on that generate my report template.
我想检查此列表的长度,并据此生成我的报告模板。 How can I check the length of ids list there and decide based on that?
如何检查那里的ID列表的长度并据此决定? This is my code where I get the ids and I checked it's length:
这是我获取ID的代码,并检查了它的长度:
<t t-if="o.referance_ids.len() > 1">
some code
....
</t>
but when I want to print my report, following error appears: 但是当我要打印报告时,出现以下错误:
QWebException: "'recuite.reference.reference' object has no attribute 'len'" while evaluating
'o.referance_ids.len() > 1'
Hi Ibrahim you can use this 嗨易卜拉欣,您可以使用此
<t t-if="len(o.referance_ids) > 1">
some code
</t>
insted of 装的
<t t-if="o.referance_ids.len() > 1">
some code
</t>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.