mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[FIX] Runbot error, try new cron code, plus @yajo review cleanup
This commit is contained in:
committed by
Rod Schouteden
parent
95bf2e4903
commit
6ce41d9c88
@@ -40,8 +40,8 @@ Installation
|
||||
|
||||
sudo apt-get install cups
|
||||
sudo apt-get install libcups2-dev
|
||||
sudo apt-get install python-dev OR sudo apt-get install python3-dev
|
||||
sudo easy_install pycups OR sudo pip install pycups
|
||||
sudo apt-get install python3-dev
|
||||
sudo pip install pycups
|
||||
|
||||
|
||||
Configuration
|
||||
@@ -77,11 +77,6 @@ displayed for the deprecated report types (RML, Webkit, ...).
|
||||
:target: https://runbot.odoo-community.org/runbot/144/11.0
|
||||
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall"/>
|
||||
<field name="model_id" ref="base_report_to_printer.model_printing_server"/>
|
||||
<field eval="'action_update_jobs'" name="function"/>
|
||||
<field eval="'()'" name="args"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.action_update_jobs()</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2016 SYLEAM (<http://www.syleam.fr>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import SUPERUSER_ID, api
|
||||
from openerp.tools.config import config
|
||||
|
||||
__name__ = 'Create a printing.server record from previous configuration'
|
||||
|
||||
|
||||
def migrate(cr, v):
|
||||
with api.Environment.manage():
|
||||
uid = SUPERUSER_ID
|
||||
env = api.Environment(cr, uid, {})
|
||||
env['printing.server'].create({
|
||||
'name': config.get('cups_host', 'localhost'),
|
||||
'address': config.get('cups_host', 'localhost'),
|
||||
'port': config.get('cups_port', 631),
|
||||
})
|
||||
@@ -15,21 +15,25 @@ odoo.define('base_report_to_printer.print', function(require) {
|
||||
|
||||
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_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_val === 'server') {
|
||||
framework.unblockUI();
|
||||
rpc.query({
|
||||
model: 'ir.actions.report',
|
||||
method: 'print_document',
|
||||
args: [action_val.context.active_ids, action_val.report_name],
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user