[WIP] Commit before rebase on latest #109 for user and view updates

Migration of printer_tray to v11 and integration with base_report_to_printer
This commit is contained in:
Graeme Gellatly
2017-10-06 01:16:33 +13:00
committed by Carlos Roca
parent a4b2721166
commit b0cc27186c
44 changed files with 2619 additions and 767 deletions

View File

@@ -4,7 +4,7 @@ odoo.define('base_report_to_printer.print', function(require) {
var ActionManager = require('web.ActionManager');
var core = require('web.core');
var framework = require('web.framework');
var Model = require('web.Model');
var rpc = require('web.rpc');
ActionManager.include({
ir_actions_report: function(action, options) {
@@ -13,23 +13,27 @@ odoo.define('base_report_to_printer.print', function(require) {
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();
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_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() {
self.do_notify(_t('Report'),
_t('Error when sending the document to the printer ') + print_action.printer_name);
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 === 'server') {
framework.unblockUI();
rpc.query({
model: 'ir.actions.report',
method: 'print_document',
args: [action_val.id, action_val.context.active_ids],
kwargs: {data: action_val.data || {}},
context: action_val.context || {}
}).then(function () {
self.do_notify(_t('Report'),
_.str.sprintf(_t('Document sent to the printer %s'), print_action.printer_name));
}).fail(function () {
self.do_notify(_t('Report'),
_.str.sprintf(_t('Error when sending the document to the printer '), print_action.printer_name));
});
} else {