Search code examples
odooreportodoo-10odoo-view

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


Solution

  • 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