vbt
vbt

Reputation: 805

How to print a table header and table data only if data is present in qweb reports

How can I print a table header and table data only if the data is present in qweb reports.

If data is not present, table header and data should be empty

Upvotes: 1

Views: 427

Answers (2)

vbt
vbt

Reputation: 805

By using <t t-set="flag" t-value="0"> initialise a flag. Then check whether any data is present in the table data by using for loop.

If any data is present, set the t-value of flag inside the for loop as 1. Then print the table header and data only when the flag's value is 1

Upvotes: 1

youssef fakih
youssef fakih

Reputation: 11

u can use a condition t-if:

<t t-if="condition">
<p>Test</p></t>

https://www.odoo.com/documentation/10.0/reference/qweb.html

Upvotes: 1

Related Questions