简体   繁体   中英

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. 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? This is my code where I get the ids and I checked it's length:

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM