mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
fix flakes8
This commit is contained in:
@@ -27,6 +27,7 @@ import base64
|
||||
from openerp import pooler
|
||||
from openerp.addons.base_calendar import base_calendar
|
||||
|
||||
|
||||
class virtual_report_spool(base_calendar.virtual_report_spool):
|
||||
|
||||
def exp_report(self, db, uid, object, ids, datas=None, context=None):
|
||||
@@ -41,22 +42,26 @@ class virtual_report_spool(base_calendar.virtual_report_spool):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
# First of all load report defaults: name, action and printer
|
||||
report_obj = pool.get('ir.actions.report.xml')
|
||||
report = report_obj.search(cr,uid,[('report_name','=',self._reports[report_id]['report_name'])])
|
||||
report = report_obj.search(
|
||||
cr, uid, [('report_name', '=', self._reports[report_id]['report_name'])])
|
||||
if report:
|
||||
report = report_obj.browse(cr,uid,report[0])
|
||||
name = report.name
|
||||
report = report_obj.browse(cr, uid, report[0])
|
||||
data = report.behaviour()[report.id]
|
||||
action = data['action']
|
||||
printer = data['printer']
|
||||
if action != 'client':
|
||||
if (self._reports and self._reports.get(report_id, False) and self._reports[report_id].get('result', False)
|
||||
and self._reports[report_id].get('format', False)):
|
||||
report_obj.print_direct(cr, uid, report.id, base64.encodestring(self._reports[report_id]['result']),
|
||||
if (self._reports and self._reports.get(report_id, False)
|
||||
and self._reports[report_id].get('result', False)
|
||||
and self._reports[report_id].get('format', False)):
|
||||
report_obj.print_direct(
|
||||
cr, uid, report.id, base64.encodestring(self._reports[report_id]['result']),
|
||||
self._reports[report_id]['format'], printer)
|
||||
# XXX "Warning" removed as it breaks the workflow
|
||||
# it would be interesting to have a dialog box to confirm if we really want to print
|
||||
# in this case it must be with a by pass parameter to allow massive impression
|
||||
#raise osv.except_osv(_('Printing...'), _('Document sent to printer %s') % (printer,))
|
||||
# raise osv.except_osv(
|
||||
# _('Printing...'),
|
||||
# _('Document sent to printer %s') % (printer,))
|
||||
|
||||
except:
|
||||
cr.rollback()
|
||||
|
||||
Reference in New Issue
Block a user