[FIX] qweb: allow string interpolation in t-call

This commit allows the t-call directive to choose a dynamic template.
This is working in QWeb Python, but was not possible in Owl.

closes #709
This commit is contained in:
Géry Debongnie
2020-10-19 12:30:58 +02:00
committed by aab-odoo
parent a28ce440dc
commit 3fbc02986c
4 changed files with 101 additions and 10 deletions
+17
View File
@@ -15,6 +15,7 @@
- [Dynamic Attributes](#dynamic-attributes)
- [Loops](#loops)
- [Rendering Sub Templates](#rendering-sub-templates)
- [Dynamic Sub Templates](#dynamic-sub-templates)
- [Translations](#translations)
- [Debugging](#debugging)
@@ -509,6 +510,22 @@ This can be used to define variables scoped to a sub template:
<!-- "var" does not exist here -->
```
### Dynamic sub templates
The `t-call` directive can also be used to dynamically call a sub template,
using string interpolation. For example:
```xml
<div t-name="main-template">
<t t-call="{{template}}">
<em>content</em>
</t>
</div>
```
Here, the name of the template is obtained from the `template` value in the
template rendering context.
### Translations
By default, QWeb specify that templates should be translated. If this behaviour