[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
This commit is contained in:
Denis Ledoux
2015-12-18 15:49:38 +01:00
parent dc25eac8d4
commit c9acaa428c
+2 -1
View File
@@ -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) {