Odoo Qweb
Qweb is an XML template engine used for HTML fragments and pages.Template engine helps to combine templates with data model for creating documents. All directives in qweb are used with the prefix of t-. Qweb is also known as Templating engine
Few of the template operation are given here-
Define variable
You can define a new variable and set a value using the following syntax :
<t t-set=”name” t-value=”value” />
Loops
T-foreach directive is used to iterate through a set of values and it contain a second parameter called t-as
<t t-foreach="[1, 2, 3, 4]" t-as="a">
<p><t t-esc="a"/></p></t>
Conditional operators using Qweb
Conditional operators are defined using the t-if conditional directive.
The syntax is as follows:
<div>
<t t-if=”condition”><operations>
</t></div>
An example is shown here:
<div>
<t t-if=”timer==0”>
<t t-set=”timer” t-value=”1” />
</t></div>
To know more about different types of operations templates and its operations.
Visit Odoo Qweb















