diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js
index 2fbef19000a..92139b3c483 100644
--- a/addons/web/static/lib/qweb/qweb2.js
+++ b/addons/web/static/lib/qweb/qweb2.js
@@ -187,6 +187,10 @@ var QWeb2 = {
}
}
}
+
+ _.each(Object.keys(old_dict), function(z) {
+ old_dict[z] = new_dict[z];
+ });
} else {
this.exception("No enumerator given to foreach", context);
}
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.
+
+::
+
+
+