Skip to content

Commit

Permalink
[FIX] Fix the javascript calls, bit hackish but it works, could be im…
Browse files Browse the repository at this point in the history
…proved
  • Loading branch information
gdgellatly committed Dec 14, 2017
1 parent 506debb commit 740ab72
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions base_report_to_printer/models/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def print_action_for_report_name(self, report_name):
serializable_result = {
'action': result['action'],
'printer_name': result['printer'].name,
'id': report.id
}
return serializable_result

Expand Down
7 changes: 3 additions & 4 deletions base_report_to_printer/static/src/js/qweb_action_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,26 @@ odoo.define('base_report_to_printer.print', function (require) {
var framework = require('web.framework');
var rpc = require('web.rpc');


ActionManager.include({
ir_actions_report: function (action, options) {
var action_val = _.clone(action);
var _t = core._t;
var self = this;
var _super = this._super;

if ('report_type' in action_val && action_val.report_type === 'qweb-pdf') {
if (action_val.report_type === 'qweb-pdf') {
framework.blockUI();
rpc.query({
model: 'ir.actions.report',
method: 'print_action_for_report_name',
args: [action_val.report_name]
}).then(function (print_action) {
if (print_action && print_action.action_val === 'server') {
if (print_action && print_action.action === 'server') {
framework.unblockUI();
rpc.query({
model: 'ir.actions.report',
method: 'print_document',
args: [action_val.context.active_ids, action_val.report_name],
args: [print_action.id, action_val.context.active_ids],
kwargs: {data: action_val.data || {}},
context: action_val.context || {}
}).then(function () {
Expand Down
1 change: 1 addition & 0 deletions base_report_to_printer/tests/test_ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def test_print_action_for_report_name_returns_if_report(self):
expect = {
'action': behaviour['action'],
'printer_name': behaviour['printer'].name,
'id': behaviour.id,
}
self.assertDictEqual(
expect, res,
Expand Down

0 comments on commit 740ab72

Please sign in to comment.