[英]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. 仅当qweb
报表中存在数据时,才如何打印表头和表数据。
If data is not present, table header and data should be empty 如果不存在数据,则表头和数据应为空
u can use a condition t-if: 您可以使用条件t-if:
<t t-if="condition">
<p>Test</p></t>
https://www.odoo.com/documentation/10.0/reference/qweb.html https://www.odoo.com/documentation/10.0/reference/qweb.html
By using <t t-set="flag" t-value="0">
initialise a flag. 通过使用<t t-set="flag" t-value="0">
初始化标志。 Then check whether any data is present in the table data by using for loop
. 然后使用for loop
检查表数据中是否存在任何数据。
If any data is present, set the t-value
of flag
inside the for loop
as 1
. 如果存在任何数据,请将for loop
内的flag
的t-value
设置为1
。 Then print the table header and data only when the flag's value is 1
然后仅在flag's value is 1
时打印表头和数据
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.