mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[MIG] base_report_to_printer: Upgrade to v9
This commit is contained in:
@@ -1,20 +1,26 @@
|
||||
openerp.base_report_to_printer = function(instance) {
|
||||
odoo.define('base_report_to_printer.print', function(require) {
|
||||
'use strict';
|
||||
|
||||
instance.web.ActionManager.include({
|
||||
var ActionManager = require('web.ActionManager');
|
||||
var core = require('web.core');
|
||||
var framework = require('web.framework');
|
||||
var Model = require('web.Model');
|
||||
|
||||
ActionManager.include({
|
||||
ir_actions_report_xml: function(action, options) {
|
||||
instance.web.blockUI();
|
||||
framework.blockUI();
|
||||
action = _.clone(action);
|
||||
var _t = instance.web._t;
|
||||
var _t = core._t;
|
||||
var self = this;
|
||||
var _super = this._super;
|
||||
|
||||
if ('report_type' in action && action.report_type === 'qweb-pdf') {
|
||||
new instance.web.Model('ir.actions.report.xml')
|
||||
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') {
|
||||
instance.web.unblockUI();
|
||||
new instance.web.Model('report')
|
||||
if (print_action && print_action.action === 'server') {
|
||||
framework.unblockUI();
|
||||
new Model('report')
|
||||
.call('print_document',
|
||||
[action.context.active_ids,
|
||||
action.report_name,
|
||||
@@ -22,7 +28,7 @@ openerp.base_report_to_printer = function(instance) {
|
||||
{data: action.data || {},
|
||||
context: action.context || {},
|
||||
})
|
||||
.then(function(result){
|
||||
.then(function(){
|
||||
self.do_notify(_t('Report'),
|
||||
_t('Document sent to the printer ') + print_action.printer_name);
|
||||
}).fail(function() {
|
||||
@@ -39,5 +45,6 @@ openerp.base_report_to_printer = function(instance) {
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user