[IMP] stock: improve generic stock controller

Include set_html in the deferred of start
This commit is contained in:
Arnold Moyaux
2018-04-06 17:05:14 +02:00
committed by Simon Lejeune
parent f384db9b67
commit 157459877e
@@ -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('<h1>Traceability Report</h1>')
self.report_widget.$el.find('.o_report_heading').html('<h1>Traceability Report</h1>');
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)},