[FIX] Runbot error, try new cron code, plus @yajo review cleanup

This commit is contained in:
Graeme Gellatly
2017-12-06 22:21:51 +13:00
parent bd5073456b
commit a06dc38f53
4 changed files with 23 additions and 43 deletions

View File

@@ -40,8 +40,8 @@ Installation
sudo apt-get install cups sudo apt-get install cups
sudo apt-get install libcups2-dev sudo apt-get install libcups2-dev
sudo apt-get install python-dev OR sudo apt-get install python3-dev sudo apt-get install python3-dev
sudo easy_install pycups OR sudo pip install pycups sudo pip install pycups
Configuration Configuration
@@ -77,11 +77,6 @@ displayed for the deprecated report types (RML, Webkit, ...).
:target: https://runbot.odoo-community.org/runbot/144/11.0 :target: https://runbot.odoo-community.org/runbot/144/11.0
Known issues / Roadmap
======================
Bug Tracker Bug Tracker
=========== ===========

View File

@@ -26,8 +26,8 @@
<field name="numbercall">-1</field> <field name="numbercall">-1</field>
<field eval="False" name="doall"/> <field eval="False" name="doall"/>
<field name="model_id" ref="base_report_to_printer.model_printing_server"/> <field name="model_id" ref="base_report_to_printer.model_printing_server"/>
<field eval="'action_update_jobs'" name="function"/> <field name="state">code</field>
<field eval="'()'" name="args"/> <field name="code">model.action_update_jobs()</field>
</record> </record>
</odoo> </odoo>

View File

@@ -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),
})

View File

@@ -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') { if ('report_type' in action_val && action_val.report_type === 'qweb-pdf') {
framework.blockUI(); framework.blockUI();
new Model('ir.actions.report'). rpc.query({
call('print_action_for_report_name', [action_val.report_name]). model: 'ir.actions.report',
then(function(print_action){ method: 'print_action_for_report_name',
if (print_action && print_action.action_val === 'server') { args: [action_val.report_name]
framework.unblockUI(); }).then(function (print_action) {
new Model('report'). if (print_action && print_action.action_val === 'server') {
call('print_document', framework.unblockUI();
[action_val.context.active_ids, action_val.report_name], rpc.query({
{data: action_val.data || {}, context: action_val.context || {}}). model: 'ir.actions.report',
then(function(){ method: 'print_document',
self.do_notify(_t('Report'), args: [action_val.context.active_ids, action_val.report_name],
_t('Document sent to the printer ') + print_action.printer_name); kwargs: {data: action_val.data || {}},
}).fail(function() { context: action_val.context || {}
self.do_notify(_t('Report'), }).then(function () {
_t('Error when sending the document to the printer ') + print_action.printer_name); 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 { } else {