Hi,
Qweb has different conditional directives. ‘t-if’ is one of them. If the given condition is true, then the element is rendered. If the condition is false, the element is not rendered.
Eg:
<t t-set="inv_ids" t-value="doc.origin"/> <t t-set="sale_order" t-value="request.env['sale.order'].search([('invoice_ids','=',inv_ids)])"/> <t t-foreach="sale_order" t-as="line"> <t t-if="http://line.name/" rel="noopener nofollow noreferrer" target="_blank">line.name"> <strong t-esc="http://line.name/" rel="noopener nofollow noreferrer" target="_blank">line.name"/> </t> </t>
QWeb has an iteration directive ‘t-foreach’ which takes an expression returning the collection to iterate on, and a second parameter ‘t-as’ provides the name to use for the "current item" of the iteration.
Here we are iterating ‘sale_order’ with parameter ‘line’.
Regards