[FIX] Review fixes

This commit is contained in:
Sylvain GARANCHER
2017-10-04 11:54:34 +02:00
parent 49062b590e
commit 9b48d16771
9 changed files with 46 additions and 39 deletions

View File

@@ -8,27 +8,23 @@ odoo.define('base_report_to_printer.print', function(require) {
ActionManager.include({
ir_actions_report: function(action, options) {
action = _.clone(action);
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')
.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]);
}
}
});
});