diff --git a/addons/stock/static/src/js/stock_traceability_report_backend.js b/addons/stock/static/src/js/stock_traceability_report_backend.js index 5ae65c7fbb4..8895243eea4 100644 --- a/addons/stock/static/src/js/stock_traceability_report_backend.js +++ b/addons/stock/static/src/js/stock_traceability_report_backend.js @@ -38,9 +38,9 @@ var stock_report_generic = AbstractAction.extend(ControlPanelMixin, { this.report_widget = new ReportWidget(this, this.given_context); def = this.report_widget.appendTo(this.$el); } - def.then(function () { + return def.then(function () { self.report_widget.$el.html(self.html); - self.report_widget.$el.find('.o_report_heading').html('

Traceability Report

') + self.report_widget.$el.find('.o_report_heading').html('

Traceability Report

'); if (self.given_context.auto_unfold) { _.each(self.$el.find('.fa-caret-right'), function (line) { self.report_widget.autounfold(line, self.given_context.lot_name); @@ -49,8 +49,10 @@ var stock_report_generic = AbstractAction.extend(ControlPanelMixin, { }); }, start: function() { - this.set_html(); - return this._super(); + var self = this; + return this._super.apply(this, arguments).then(function () { + self.set_html(); + }); }, // Fetches the html and is previous report.context if any, else create it get_html: function() { @@ -97,7 +99,7 @@ var stock_report_generic = AbstractAction.extend(ControlPanelMixin, { }); }); framework.blockUI(); - var url_data = self.controller_url.replace('active_id', self.given_context['active_id']); + var url_data = self.controller_url.replace('active_id', self.given_context.active_id); session.get_file({ url: url_data.replace('output_format', 'pdf'), data: {data: JSON.stringify(dict)},