mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] compiler: call dynamic templates with correct this
This commit is contained in:
committed by
Aaron Bohy
parent
2601a176c4
commit
0bbea351a6
@@ -46,9 +46,9 @@ export class TemplateSet {
|
||||
dev?: boolean;
|
||||
|
||||
constructor() {
|
||||
const call = (subTemplate: string, ctx: any, parent: any) => {
|
||||
const call = (owner: any, subTemplate: string, ctx: any, parent: any) => {
|
||||
const template = this.getTemplate(subTemplate);
|
||||
return toggler(subTemplate, template(ctx, parent));
|
||||
return toggler(subTemplate, template.call(owner, ctx, parent));
|
||||
};
|
||||
|
||||
const getTemplate = (name: string) => this.getTemplate(name);
|
||||
|
||||
@@ -898,7 +898,7 @@ export class CodeGenerator {
|
||||
const templateVar = this.generateId("template");
|
||||
this.addLine(`const ${templateVar} = ${subTemplate};`);
|
||||
block = this.createBlock(block, "multi", ctx);
|
||||
this.insertBlock(`call(${templateVar}, ctx, node, ${key})`, block!, {
|
||||
this.insertBlock(`call(this, ${templateVar}, ctx, node, ${key})`, block!, {
|
||||
...ctx,
|
||||
forceNewBlock: !block,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user