Exploring the QWeb template language
The QWeb parser looks for special directives in the templates and replaces them with dynamically generated HTML. These directives are XML element attributes and can be used in any valid tag or element – for example, <div>
, <span>
, or <field>
.
Sometimes, a QWeb directive needs to be used, but we don't want to place it in any of the XML elements in the template. For these cases, the <t>
special element can be used. It can have QWeb directives such as t-if
or t-foreach
, but it is silent, and it won't have any effect on the final XML/HTML produced.
The QWeb directives frequently use evaluated expressions to produce different effects that depend on record values. The language used to evaluate these expressions depends on the environment where the QWeb is being executed. There are two different QWeb implementations: client-side JavaScript and server-side Python. Reports and website pages use the server-side...