When Odoo still using jinja2 template, we can make for loop like example the code bellow:
% for i in range(len(object.invoice_line_ids)):
${i+1}${'.'.ljust(2)}
% endfor
But in Odoo15, the code doesn't work again,
I try to read this document and trying to apply the for loop like qweb code:
https://www.odoo.com/documentation/15.0/developer/reference/frontend/qweb.html#loops
Like the example bellow:
isn't it will be working on CDATA?
When I try to check the result, it showing the code directly, not the loopin result:
I also try to create for loop like the bellow ways:
{% for item in range(10) }}
{ item }
{% endfor }}
% for item in range(10):
${item}
% endfor
{% for item in range(10):}
${item}
{% endfor }
{% for item in range(10)}:
${item}
{% endfor }
{% item for item in range(10) %}
{% for item in range(10) %}
{{ item }}
{% endfor %}
{% for item in range(10) %}
{{{ item }}}
{% endfor %}
{{item for item in range(10)}}
{{% item for item in range(10) %}}
{% item for item in range(10) %}
But nothing is working in Odoo15 using the code above.
This is the worked code on Odoo13:
https://paste.opensuse.org/29906326
And I try to upgrade it to Odoo15 with few adjusemtn like bellow snippet of code:
https://paste.opensuse.org/75175196
But still don't work correctly.
My goals on this is, how to print customer invoice to dotmatrix printer, so I using CDATA.
So how to write for loop in inline_template Odoo15?,or is there any source, tutorial, documentations to learn about that things?
Thanks,
Tri Nanda
Hello Tri Nanda, did you find the solution to this problem? I have the same issue.
Interesting. Can you share the method, please?
Another question. My document doesn't show the actual format. It shows up as a string with this at the beginning {1: Markup(' Invoice INV/2022/00001\n .... how can I fix it?