diff options
| author | lul-odoo <lul@odoo.com> | 2018-11-23 08:22:07 +0000 |
|---|---|---|
| committer | lul-odoo <lul@odoo.com> | 2018-12-03 08:03:09 +0000 |
| commit | 9b6073c3ea6264f59fb11e6f797f4fff200c3d5d (patch) | |
| tree | 557b4aa4bb4e40145fc9839ca7d3773682aa3236 /addons/web/static/src/js | |
| parent | f8dad1bb4b712d8f34035420ef1f6e484c638f5b (diff) | |
[FIX] web: Load form subviews without previous '*_view_ref' in context
On a form view of model A, if a many2one field (model B) has a [tree|form]_view_ref in the context
(to display a custom 'Search More...' tree view dialog for example),
when clicking on this field to display the model B form view, the context key *_view_ref is passed
when loading subviews (model C) making them crash because the view ref corresponds to the model B.
After this commit, '*_view_ref' keys in the context are dropped when loading subviews
closes odoo/odoo#29022
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/views/form/form_view.js | 7 |
1 files changed, 6 insertions, 1 deletions
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 01474a01180..fb228f5a636 100644 --- a/addons/web/static/src/js/views/form/form_view.js +++ b/addons/web/static/src/js/views/form/form_view.js @@ -97,9 +97,14 @@ var FormView = BasicView.extend({ while (matches = regex.exec(attrs.context)) { context[matches[1]] = matches[2]; } + + // Remove *_view_ref coming from parent view + var refinedContext = _.pick(self.loadParams.context, function (value, key) { + return key.indexOf('_view_ref') === -1; + }); defs.push(parent.loadViews( field.relation, - new Context(context, self.userContext, self.loadParams.context).eval(), + new Context(context, self.userContext, refinedContext).eval(), [[null, attrs.mode === 'tree' ? 'list' : attrs.mode]]) .then(function (views) { for (var viewName in views) { |
