[FIX] qweb: issue when rendering twice dynamic t-calls

The previous implementation generated an id each time the template was
rendered, instead of just once per new dynamic template found.
This commit is contained in:
Géry Debongnie
2020-10-19 22:17:10 +02:00
committed by aab-odoo
parent ed9d820d9e
commit a68d7774c6
3 changed files with 37 additions and 6 deletions
+3 -2
View File
@@ -236,8 +236,9 @@ QWeb.addDirective({
if (isDynamic) {
const _id = ctx.generateID();
ctx.addLine(`let tname${_id} = ${ctx.interpolate(subTemplate)};`);
ctx.addLine(`let tid${_id} = this.constructor.nextId++;`);
ctx.addIf(`!(tname${_id} in this.subTemplates)`);
ctx.addLine(`let tid${_id} = this.subTemplates[tname${_id}];`);
ctx.addIf(`!tid${_id}`);
ctx.addLine(`tid${_id} = this.constructor.nextId++;`);
ctx.addLine(`this.subTemplates[tname${_id}] = tid${_id};`);
ctx.addLine(
`this.constructor.subTemplates[tid${_id}] = this._compile(tname${_id}, {hasParent: true, defineKey: true});`