[FIX] qweb: fix issue variables set in body of t-call

The body of a t-call directive may be used to define private variables
to the sub template call.

However, the code that handles t-call worked like this:

- compile sub template if necessary
- then compile body of t-call to extract variables

This means that the variables defined in the t-call body were not yet
processed and available in the context.  Because of that, when the call
to t-esc is done, there is not internal qweb var, and the code simply
outputs a scope['varname'], which is in our case a VDOMArray, so it is
displayed as [object object]

What this fix does is changing the way t-esc works: if we are in the
context of a sub template, then it assumes that any outside variable may
or may not be a VDomArray, so it needs to check and eventually convert
it to a string, if necessary.

closes #719
This commit is contained in:
Géry Debongnie
2020-09-16 09:58:57 +02:00
committed by aab-odoo
parent 2529aa3ef2
commit 3bf91afc3f
5 changed files with 56 additions and 2 deletions
+1
View File
@@ -22,6 +22,7 @@ export class CompilationContext {
shouldDefineUtils: boolean = false;
shouldDefineRefs: boolean = false;
shouldDefineResult: boolean = true;
isSubTemplate: boolean = false;
loopNumber: number = 0;
inPreTag: boolean = false;
templateName: string;