mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
We need the report in print_document and print options (needed in
printer_tray)
This commit is contained in:
committed by
Sylvain GARANCHER
parent
ad5e8b6e46
commit
39bd5e94e4
@@ -224,7 +224,7 @@ class PrintingPrinter(models.Model):
|
|||||||
uri = fields.Char(string='URI', readonly=True)
|
uri = fields.Char(string='URI', readonly=True)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def print_options(self, format):
|
def print_options(self, report, format):
|
||||||
""" Hook to set print options """
|
""" Hook to set print options """
|
||||||
options = {}
|
options = {}
|
||||||
if format == 'raw':
|
if format == 'raw':
|
||||||
@@ -232,7 +232,7 @@ class PrintingPrinter(models.Model):
|
|||||||
return options
|
return options
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def print_document(self, content, format):
|
def print_document(self, report, content, format):
|
||||||
""" Print a file
|
""" Print a file
|
||||||
|
|
||||||
Format could be pdf, qweb-pdf, raw, ...
|
Format could be pdf, qweb-pdf, raw, ...
|
||||||
@@ -246,7 +246,7 @@ class PrintingPrinter(models.Model):
|
|||||||
os.close(fd)
|
os.close(fd)
|
||||||
connection = cups.Connection()
|
connection = cups.Connection()
|
||||||
|
|
||||||
options = self.print_options(format)
|
options = self.print_options(report, format)
|
||||||
|
|
||||||
connection.printFile(self.system_name,
|
connection.printFile(self.system_name,
|
||||||
file_name,
|
file_name,
|
||||||
|
|||||||
@@ -35,5 +35,5 @@ class Report(models.Model):
|
|||||||
action = data['action']
|
action = data['action']
|
||||||
printer = data['printer']
|
printer = data['printer']
|
||||||
if action != 'client' and result:
|
if action != 'client' and result:
|
||||||
printer.print_document(result, report.report_type)
|
printer.print_document(report, result, report.report_type)
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ def exp_report_get(db, uid, report_id):
|
|||||||
if (self_reports and self_reports.get(report_id)
|
if (self_reports and self_reports.get(report_id)
|
||||||
and self_reports[report_id].get('result')
|
and self_reports[report_id].get('result')
|
||||||
and self_reports[report_id].get('format')):
|
and self_reports[report_id].get('format')):
|
||||||
printer.print_document(self_reports[report_id]['result'],
|
printer.print_document(report,
|
||||||
|
self_reports[report_id]['result'],
|
||||||
self_reports[report_id]['format'])
|
self_reports[report_id]['format'])
|
||||||
# FIXME "Warning" removed as it breaks the workflow
|
# FIXME "Warning" removed as it breaks the workflow
|
||||||
# it would be interesting to have a dialog box to
|
# it would be interesting to have a dialog box to
|
||||||
|
|||||||
Reference in New Issue
Block a user