I would like to make a loop to print elements an exact amount of times. Something like this:
<t t-for="o.label_qty" >
...
</t>
Where o.label_qty
is an integer number.
But I can use only a t-foreach
loop in qweb:
<t t-foreach="o.pack_operation_ids" t-as="l" >
...
</t>
Is there a way to do this?
If not I'm thinking the only solution is to create a dummy list with o.label_qty
elements and write it in the foreach.
The t-foreach
directive accepts a Python expression.
So, you could use range()
just like in Python for
loops:
<t t-foreach="range(o.label_qty)" t-as="l">
...
</t>