Documents and web pages in Odoo are not static; they present the system's data in a designed layout. QWeb is the templating that does that. This piece explains QWeb templates.
What QWeb is
QWeb is Odoo's templating. Templating, in general, is the means of defining something, a document, a web page, that combines a designed layout with data: the template defines the layout and the structure, and the genuine data is placed into it to produce the genuine result. QWeb is Odoo's particular templating, and it is what is used in Odoo to define things that combine a layout with the system's data.
What QWeb templates are used for
QWeb templates are used in Odoo wherever a document or a page presents the system's data in a designed layout. The PDF reports, the printable documents Odoo produces, are defined with QWeb templates: the template defines the document's layout, and the genuine data fills it. The web pages of an Odoo website are, likewise, defined with QWeb. So QWeb is the common templating behind the documents and the pages, the things in Odoo that present data in a designed form. A developer who builds reports or works on the website works with QWeb templates.
How a QWeb template works
A QWeb template works by defining a layout and structure into which the system's genuine data is placed. The template defines what the document or page looks like, its structure and design, and it expresses where and how the genuine data, of the genuine record, is placed within that. When the document or page is produced, the genuine data fills the template, and the result is the genuine document or page, the designed layout with the real data in it. So a QWeb template is, in essence, a designed layout that knows where the genuine data goes.
Why QWeb templates produce genuine results
An important quality of QWeb templates is that, because they combine a layout with the system's genuine data, the documents and pages they produce are genuine, reflecting the real data. A QWeb-defined document is not a separately maintained thing that could be wrong; it is the template filled with the genuine, current data of the record. So the documents and pages QWeb produces are true: they present the genuine data. This is part of the value of producing documents and pages from the system through templating, the results are genuine.
Work with QWeb the Odoo way
QWeb is part of Odoo, and working with QWeb templates, like all Odoo development, should be done the Odoo way: QWeb has its established way of being used, and templates built that way work properly within the framework. A developer working with QWeb templates, for reports or for the website, should do it within Odoo's conventions, working with the framework. QWeb is the templating Odoo provides, and it is used as Odoo intends.
The takeaway
QWeb templates in Odoo are Odoo's templating, the means of defining documents and pages that combine a designed layout with the system's data. QWeb is used for the PDF reports, the printable documents, and for the web pages of an Odoo website. A QWeb template defines a layout and expresses where the genuine data goes, and when the document or page is produced, the genuine data fills it, so the result is true, reflecting the real data. Work with QWeb the Odoo way. For how we approach Odoo, see our ERP practice.