From 191f9d05984a02bda5717ccd9256d44e130cfd35 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Wed, 8 Nov 2017 15:55:29 +0100 Subject: [PATCH] [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. --- addons/web/static/src/js/views/basic/basic_view.js | 3 +++ 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; }, //--------------------------------------------------------------------------