From f0cfe7c174307009575661d8ebe4c2e5d84c1768 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 9 Mar 2017 12:44:40 +0100 Subject: [FIX] web: load missing fields when opening form view dialogs Problem was that sub form field has usually more fields than the list view in one2many, so we have to load missing fields --- addons/web/static/src/js/views/basic/basic_view.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_view.js') 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 aea0b88dcf3..d8e41b99835 100644 --- a/addons/web/static/src/js/views/basic/basic_view.js +++ b/addons/web/static/src/js/views/basic/basic_view.js @@ -115,7 +115,13 @@ var BasicView = AbstractView.extend({ */ _loadData: function () { if (this.recordID) { - return $.when(this.recordID); + var record = this.model.get(this.recordID); + var fieldNames = _.difference(record.fieldNames, Object.keys(record.data)); + if (fieldNames.length && !this.model.isNew(record.id)) { + return this.model.reload(this.recordID, {fieldNames: fieldNames}); + } else { + return $.when(this.recordID); + } } return this._super.apply(this, arguments); }, -- cgit v1.2.3