In Odoo templates, the t-set attribute is used to set a variable to a given value. However, t-set doesn't support modifying a list in-place, such as appending elements to it.
To accomplish this, you can use the t-operation attribute instead, which allows you to perform operations on the value of a variable. In your case, you can use the t-operation attribute to append elements to the foo list as follows:
t-set="foo" t-value="[]"/>
t-foreach="[1,2,3]" t-as="i">
t-operation="foo.append(10)"/>
t-esc="i"/>
Alternatively, you can use the t-call attribute to call a Python function that modifies the list in-place. Here is an example:
!-- Define a Python function that appends 10 to the given list -->
t-call="website.append_to_list" t-args="foo"/>
t-foreach="[1,2,3]" t-as="i">
t-call="website.append_to_list" t-args="foo"/>
t-esc="i"/>
foo = t-esc="foo"/>
In the Python code of your website, you would need to define the append_to_list function as follows:
def append_to_list(foo):
foo.append(10)
Hope this helps!