From c9acaa428cba36bbee5b9e97eca23673cacb0b15 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 18 Dec 2015 15:42:02 +0100 Subject: [PATCH] [FIX] web: view pivot, start must wait load_fields in `view_pivot.js`, the method `view_loading` must wait the `self.fields` variable to be defined before working properly. This `self.fields` variable is filled in the `prepare_fields` method, which is called in the `start` method, through a deferred named `load_fields`. `view_loading` is called in `start`, in `views.js`. Therefore, in the overriden method `start` of `view_pivot.js`, the call to `_super`, calling the `start` of `views.js`, must wait for the `load_fields` deferred to be resolved. Otherwise, the `self.fields` variable, mentioned above, won't be filled in time. opw-660153 --- addons/web/static/src/js/view_pivot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_pivot.js b/addons/web/static/src/js/view_pivot.js index b9e3f07cb00..6e09c8ed098 100644 --- a/addons/web/static/src/js/view_pivot.js +++ b/addons/web/static/src/js/view_pivot.js @@ -65,8 +65,9 @@ instance.web.PivotView = instance.web.View.extend({ var load_fields = this.model.call('fields_get', [], {context: this.dataset.get_context()}) .then(this.prepare_fields.bind(this)); + var _super = this._super.bind(this); - return $.when(this._super(), load_fields).then(this.render_buttons.bind(this)).then(function(){ + return load_fields.then(function(){return _super();}).then(this.render_buttons.bind(this)).then(function(){ if (self.$sidebar) { return openerp.session.rpc('/web/pivot/check_xlwt').then(function (result) { if (result) {