I am using Odoo 13, but this is a QWeb question:
I got the following template in QWeb:
<template id="my_subtemplate">
<t t-set="foo" t-value="foo + 1"/>
<p>Inside subtemplate: <t t-esc="foo"/></p>
</template>
In other template, I call it twice, this way:
<t t-set="foo" t-value="1"/>
<t t-call="my_module.my_subtemplate"/>
<t t-call="my_module.my_subtemplate"/>
<p>Inside main template: <t t-esc="foo"/></p>
So when I call the main template, I expect to get this result:
Inside subtemplate: 2
Inside subtemplate: 3
Inside main template: 3
However, I am getting this one:
Inside subtemplate: 2
Inside subtemplate: 2
Inside main template: 1
Can't variables be modified in a subtemplate? Any ideas of how to do such a simple task?