Professional Documents
Culture Documents
WWW Cybrosys Com Blog Basic Qweb Operations in Odoo 15
WWW Cybrosys Com Blog Basic Qweb Operations in Odoo 15
JUN 22,2022
Qweb is a reporting or template engine that can be used to build reports. Odoo uses
Qweb to generate reports.web has a number of tools for making reports. We may
easily alter the data by utilizing Qweb.
We'll go over the fundamental features of Qweb for making reports. For the
operations, we use XML attributes prefixed with 't-'.We may construct a new
variable, set a value to it, and utilize it in our template just like any other
programming language.
Define a Variable
We can use t-set to define a variable and the basic syntax to define a variableid
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
For Example
Here we can see that create a variable with name word_cound also assign its value
as one it is a static value
Here the value of the word_count variable is the value that is returned from a
function that we specified on the above code ‘word_count()’.
We do not need to indicate the variable type when we define it. In Odoo, we can have
a variety of variables, including numbers, texts, arrays (lists), and dictionaries,
among others. If we need to define a dictionary, we can use the following code to
accomplish so:
We can also make lists in the same way. A loop can be used to iterate over the
different values of a list or dictionary.
Find Output
In order to get the output a value, qweb provides two directives that are t-esc and t-
raw. The commonly used directive is t-esc.
Example of t-esc:
<t t-esc="values"/>
<t t-raw="myvar"/>
t-esc operation will evaluate the variable and get the content of that variable. The
primary distinction between t-esc and t-raw is that t-esc will automatically HTML-
escape its text, whereas t-raw will not.
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Conditional Operators
We can work some conditions over a function or print a variable for that we can use
conditional operations. Mainly we use t-if
For example
The above example checks whether the value of the count equals zero or not. That
will equal to zero code getting inside the condition and working the code inside the
condition otherwise it will not work.
Example:
Here there are two conditions that are checked either the first or second is satisfied
the code will get inside the condition.
Loops
We may need to iterate over a set of values in some circumstances. If we have a list
or a dictionary and need to iterate through each value, we can do so with t-for each.
t-call directive is mainly used for calling other templates from qweb. This can be
used in a template or for top-level
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
<t t-call="other_template"/>
The above discussed are some of the basic Qweb operations in Odoo. I hope that
everyone can get a basic idea about this topic.
If you need any assistance in odoo, we are online, please chat with us.
Related Blogs
0 Comments
Leave a comment
Name
Website
Comment
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Post Comment
CALICUT LONDON
Cybrosys Technologies Pvt. Ltd. Cybrosys Limited
Neospace, Kinfra Techno Park Alpha House,
Kakkancherry, Calicut 100 Borough High Street, London,
Kerala, India - 673635 SE1 1LB, United Kingdom
KOCHI BANGALORE
Cybrosys Technologies Pvt. Ltd. Cybrosys Techno Solutions
1st Floor, Thapasya Building, The Estate, 8th Floor,
Infopark, Kakkanad, Dickenson Road,
Kochi, India - 682030. Bangalore, India - 560042
SEND US A MESSAGE
Full Name
Phone
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Your Message
SEND
QUICK LINKS
Odoo
Odoo Apps
Odoo Partners
Contact us
Sitemap
SERVICES
Odoo Customization
Odoo Implementation
Odoo Integration
Odoo Support
Odoo Migration
Odoo Consultancy
Odoo Training
Odoo Licensing
REFERENCE
Odoo ERP
Odoo Software
Odoo vs SAP
Odoo vs Dynamics
Odoo vs Netsuite
Odoo vs Sage
STAY IN TOUCH
+91 8606827707
info@cybrosys.com
+91 8606827707
CONNECT SOCIALLY
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com