mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[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:
+3
-1
@@ -413,10 +413,12 @@ export class QWeb extends EventBus {
|
||||
name: string,
|
||||
elem: Element,
|
||||
parentContext?: CompilationContext,
|
||||
defineKey?: boolean
|
||||
defineKey?: boolean,
|
||||
isSubTemplate?: boolean
|
||||
): CompiledTemplate {
|
||||
const isDebug = elem.attributes.hasOwnProperty("t-debug");
|
||||
const ctx = new CompilationContext(name);
|
||||
ctx.isSubTemplate = Boolean(isSubTemplate);
|
||||
if (elem.tagName !== "t") {
|
||||
ctx.shouldDefineResult = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user