summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2015-01-30 14:03:10 +0100
committerJeremy Kersten <jke@odoo.com>2015-01-30 14:09:02 +0100
commitb2c0b4e9edc9c439c9a868d39356b7c442f3e253 (patch)
tree64593e1e0ef6df13a2c35249404c19fde3679b50 /doc/reference
parent89ccab63533f93f9599171a4e7bf9598e745978a (diff)
[IMP] qweb: Allow to propagate value to variables outside the loop.
If the variable was existing outside the context of the ``foreach``, the value is copied at the end of the foreach into the global context. Fix #4461 - Q74531 - Q71486 - Q71675
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