summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-04-21 08:48:35 +0200
committerAaron Bohy <aab@odoo.com>2017-04-25 08:07:17 +0200
commitf5bfa3d3b653c8ec8a9a1820eeff995a7f954ca9 (patch)
tree1cf332dc47268bc1006316d0d5d73b41189d9806 /addons/web/static/src/js/views
parent6e850085042ee0132157823a97da8ffe47a9279e (diff)
[FIX] web: FormView: don't modify record's context
Before this rev., some keys were added to the context of a record if there were x2many fields in the form view with a context defined on their node (containing *_view_ref keys, specifying the fields_view to load to display the relational data). Those keys should not be added to the main record's context, and it may cause errors (e.g. click on the 'Procurements' stat button in the Product form view).
Diffstat (limited to 'addons/web/static/src/js/views')
-rw-r--r--addons/web/static/src/js/views/abstract_view.js2
-rw-r--r--addons/web/static/src/js/views/form/form_view.js8
2 files changed, 6 insertions, 4 deletions
diff --git a/addons/web/static/src/js/views/abstract_view.js b/addons/web/static/src/js/views/abstract_view.js
index e1066e56e92..fdb029da6c3 100644
--- a/addons/web/static/src/js/views/abstract_view.js
+++ b/addons/web/static/src/js/views/abstract_view.js
@@ -102,6 +102,8 @@ var AbstractView = Class.extend({
if (params.modelName) {
this.loadParams.modelName = params.modelName;
}
+
+ this.userContext = params.userContext;
},
//--------------------------------------------------------------------------
diff --git a/addons/web/static/src/js/views/form/form_view.js b/addons/web/static/src/js/views/form/form_view.js
index 2a1eb2b4da5..4fff1a74ee4 100644
--- a/addons/web/static/src/js/views/form/form_view.js
+++ b/addons/web/static/src/js/views/form/form_view.js
@@ -64,16 +64,16 @@ var FormView = BasicView.extend({
attrs.limit = attrs.mode === "tree" ? 80 : 40;
if (attrs.Widget.prototype.useSubview && !(attrs.invisible && JSON.parse(attrs.invisible)) && !attrs.views[attrs.mode]) {
+ var context = {};
var regex = /'([a-z]*_view_ref)' *: *'(.*?)'/g;
var matches;
while (matches = regex.exec(attrs.context)) {
- self.loadParams.context[matches[1]] = matches[2];
+ context[matches[1]] = matches[2];
}
defs.push(parent.loadViews(
field.relation,
- new Context(self.loadParams.context),
- [[null, attrs.mode === 'tree' ? 'list' : attrs.mode]],
- {})
+ new Context(context, self.userContext),
+ [[null, attrs.mode === 'tree' ? 'list' : attrs.mode]])
.then(function (views) {
for (var viewName in views) {
attrs.views[viewName] = views[viewName];