summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
Diffstat (limited to 'doc/reference')
-rw-r--r--doc/reference/qweb.rst20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/reference/qweb.rst b/doc/reference/qweb.rst
index a7564ded394..30ef4c25196 100644
--- a/doc/reference/qweb.rst
+++ b/doc/reference/qweb.rst
@@ -158,6 +158,26 @@ variables for various data points:
a boolean flag indicating that the current iteration round is on an odd
index
+
+These extra variables provided and all new variables created into the
+``foreach`` are only available in the scope of the``foreach``. If the
+variable exists outside the context of the ``foreach``, the value is copied
+at the end of the foreach into the global context.
+
+::
+
+ <t t-set="existing_variable" t-value="False"/>
+ <!-- existing_variable now False -->
+
+ <p t-foreach="[1, 2, 3]" t-as="i">
+ <t t-set="existing_variable" t-value="True"/>
+ <t t-set="new_variable" t-value="True"/>
+ <!-- existing_variable and new_variable now True -->
+ </p>
+
+ <!-- existing_variable always True -->
+ <!-- new_variable undefined -->
+
.. _reference/qweb/attributes:
attributes