[MIG] base_report_to_printer: Migrate to v11.0

This commit is contained in:
Sylvain GARANCHER
2017-10-03 17:14:08 +02:00
committed by Carlos Roca
parent b6700501e9
commit a4b2721166
23 changed files with 182 additions and 481 deletions

View File

@@ -7,28 +7,24 @@ odoo.define('base_report_to_printer.print', function(require) {
var Model = require('web.Model');
ActionManager.include({
ir_actions_report_xml: function(action, options) {
action = _.clone(action);
ir_actions_report: function(action, options) {
action_val = _.clone(action);
var _t = core._t;
var self = this;
var _super = this._super;
if ('report_type' in action && action.report_type === 'qweb-pdf') {
if ('report_type' in action_val && action_val.report_type === 'qweb-pdf') {
framework.blockUI();
new Model('ir.actions.report.xml')
.call('print_action_for_report_name', [action.report_name])
.then(function(print_action){
if (print_action && print_action.action === 'server') {
new Model('ir.actions.report').
call('print_action_for_report_name', [action_val.report_name]).
then(function(print_action){
if (print_action && print_action.action_val === 'server') {
framework.unblockUI();
new Model('report')
.call('print_document',
[action.context.active_ids,
action.report_name,
],
{data: action.data || {},
context: action.context || {},
})
.then(function(){
new Model('report').
call('print_document',
[action_val.context.active_ids, action_val.report_name],
{data: action_val.data || {}, context: action_val.context || {}}).
then(function(){
self.do_notify(_t('Report'),
_t('Document sent to the printer ') + print_action.printer_name);
}).fail(function() {
@@ -37,14 +33,12 @@ odoo.define('base_report_to_printer.print', function(require) {
});
} else {
return _super.apply(self, [action, options]);
return _super.apply(self, [action_val, options]);
}
});
} else {
return _super.apply(self, [action, options]);
return _super.apply(self, [action_val, options]);
}
}
});
});