How can I check the state of a checkbox inside a t-foreach of a QWeb report?
The idea is to print the name and number from the same model if the checkbox is checked.
So far I can loop over the records and I can print out the name & number but now my question is.. how can I write a t-if that checks if the checkbox is checked or not?
<t t-if="company.bank_ids" t-foreach="company.bank_ids" t-as="item">
<!--This line should check if the checkbox is checked or not..-->
If I remove the t-if <item.footer=='True'"> I'll get every line printed. How can I only print the values of the record that has a checkbox set to true?
With kind regards
Condition you are using is logically wrong. You have given your condition value as a string ('True') not as boolean value.
You can use conditional statements same as python.
It should work like this:
If you want to check for False condition:
<t t-if="not item.footer">
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 1/2/15, 12:01 PM|
|Seen: 2692 times|
|Last updated: 3/16/15, 8:10 AM|