QWeb is an XML-based templating language, similar to Genshi, Thymeleaf or Facelets. It has the following characteristics:
It's implemented fully in JavaScript and rendered in the browser
Each template file (XML files) contains multiple templates.
It has special support in Odoo Web's Widget(), though it can be used outside of Odoo's web client (and it's possible to use Widget() without relying on QWeb
For Example code is below.
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="HomePageTemplate">
<div style="background-color: red;">This is simple HTML</div>
</t>
</templates>
Note-QWeb.render() looks for the specified template, renders it to a string and returns the result.
0 Comment(s)