diff options
| author | Martin Geubelle <mge@odoo.com> | 2017-11-08 15:55:29 +0100 |
|---|---|---|
| committer | Martin Geubelle <mge@odoo.com> | 2017-11-08 17:19:28 +0100 |
| commit | 191f9d05984a02bda5717ccd9256d44e130cfd35 (patch) | |
| tree | bf3574d885fb55abb4ea1130374a5cfb68e0daf5 | |
| parent | c13c9e0b5c6ff8a8ae030ff2467d4675fb6197b8 (diff) | |
[FIX] web: reuse the same BasicModel instance
Before this revision, only the FormView allowed to reuse the same datapoint.
This was only used when opening a FormViewDialog when opening the form view
of record in a one2many field.
However, this could be useful in other places for other views. In Studio for
example, we need to instantiate a x2m view without the parent view ; we thus
need to be able to reuse the same model for all basic views.
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_view.js | 3 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/form/form_view.js | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_view.js b/addons/web/static/src/js/views/basic/basic_view.js index bdc250011f0..8a91e2b90c7 100644 --- a/addons/web/static/src/js/views/basic/basic_view.js +++ b/addons/web/static/src/js/views/basic/basic_view.js @@ -47,7 +47,10 @@ var BasicView = AbstractView.extend({ this.loadParams.context = params.context || {}; this.loadParams.limit = parseInt(viewInfo.arch.attrs.limit, 10) || params.limit; this.loadParams.viewType = this.viewType; + this.loadParams.parentID = params.parentID; this.recordID = params.recordID; + + this.model = params.model; }, //-------------------------------------------------------------------------- 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 b48a5488848..42cf5de12e4 100644 --- a/addons/web/static/src/js/views/form/form_view.js +++ b/addons/web/static/src/js/views/form/form_view.js @@ -27,7 +27,6 @@ var FormView = BasicView.extend({ var mode = params.mode || (params.currentId ? 'readonly' : 'edit'); this.loadParams.type = 'record'; - this.loadParams.parentID = params.parentID; this.controllerParams.disableAutofocus = params.disable_autofocus; this.controllerParams.hasSidebar = params.sidebar; @@ -41,7 +40,6 @@ var FormView = BasicView.extend({ this.controllerParams.mode = mode; this.rendererParams.mode = mode; - this.model = params.model; }, //-------------------------------------------------------------------------- |
