From 206453c83689ad0dc6ceec3686153ab79bf88660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 27 Feb 2017 19:39:41 +0100 Subject: [FIX] web: various fixes with one2many/formviewdialogs We share the basic model record between views, and we have to make sure that everything is properly coordinated. The main issue solved by this commit is the fact that we can now edit a one2many record, then close the dialog, then edit it again and finally cancel the changes, which bring us to the previous step. Also, we had to slightly improve the AbstractView API --- addons/web/static/src/js/views/basic/basic_view.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (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 947a3ad26b6..aea0b88dcf3 100644 --- a/addons/web/static/src/js/views/basic/basic_view.js +++ b/addons/web/static/src/js/views/basic/basic_view.js @@ -99,12 +99,26 @@ var BasicView = AbstractView.extend({ this.loadParams.fieldNames = fieldNames; this.loadParams.fields = fields; this.loadParams.limit = parseInt(arch.attrs.limit, 10) || params.limit; + this.recordID = params.recordID; }, //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- + /** + * In some cases, we already have a preloaded record + * + * @override + * @private + * @returns {Deferred} + */ + _loadData: function () { + if (this.recordID) { + return $.when(this.recordID); + } + return this._super.apply(this, arguments); + }, /** * Visit all nodes in the arch field and process each fields * -- cgit v1.2.3