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:
Guewen Baconnier
2015-01-21 14:56:23 +01:00
committed by Carlos Roca
parent 74ce12bf3f
commit 79549a7bf4
8 changed files with 225 additions and 71 deletions

View File

@@ -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 = {}