mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
Do no longer returns a PDF when a report is printed
Instead, a notification is displayed to the user. When report.get_pdf() is called on a report that must be printer, it will print the report *and* returns the pdf, thus code that calls directly report.get_pdf() will print the pdf on the printer as expected. Fixes #16
This commit is contained in:
committed by
Carlos Roca
parent
74ce12bf3f
commit
79549a7bf4
@@ -52,6 +52,23 @@ class ReportXml(models.Model):
|
||||
'user basis'
|
||||
)
|
||||
|
||||
@api.model
|
||||
def print_action_for_report_name(self, report_name):
|
||||
""" Returns if the action is a direct print or pdf
|
||||
|
||||
Called from js
|
||||
"""
|
||||
report_obj = self.env['report']
|
||||
report = report_obj._get_report_from_name(report_name)
|
||||
if not report:
|
||||
return {}
|
||||
result = report.behaviour()[report.id]
|
||||
serializable_result = {
|
||||
'action': result['action'],
|
||||
'printer_name': result['printer'].name,
|
||||
}
|
||||
return serializable_result
|
||||
|
||||
@api.multi
|
||||
def behaviour(self):
|
||||
result = {}
|
||||
|
||||
Reference in New Issue
Block a user