mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[IMP] base_report_to_printer: exceptions notifications
Better handling of exceptions feedback. A notification will show up with the issued printer and report and a button for the user to download the report as a fallback to the failure. TT51628
This commit is contained in:
@@ -59,6 +59,8 @@ class IrActionsReport(models.Model):
|
||||
"skip_printer_exception"
|
||||
):
|
||||
serializable_result["printer_exception"] = True
|
||||
if self.env.context.get("force_print_to_client"):
|
||||
serializable_result["action"] = "client"
|
||||
return serializable_result
|
||||
|
||||
def _get_user_default_print_behaviour(self):
|
||||
@@ -135,7 +137,10 @@ class IrActionsReport(models.Model):
|
||||
|
||||
return True
|
||||
else:
|
||||
return self.print_document(record_ids, data=data)
|
||||
try:
|
||||
return self.print_document(record_ids, data=data)
|
||||
except Exception:
|
||||
return
|
||||
|
||||
def print_document_threaded(self, report_id, record_ids, data):
|
||||
with registry(self._cr.dbname).cursor() as cr:
|
||||
@@ -171,6 +176,7 @@ class IrActionsReport(models.Model):
|
||||
else:
|
||||
title = self.report_name
|
||||
behaviour["title"] = title
|
||||
behaviour["res_ids"] = record_ids
|
||||
# TODO should we use doc_format instead of report_type
|
||||
return printer.print_document(
|
||||
self, document, doc_format=self.report_type, **behaviour
|
||||
|
||||
Reference in New Issue
Block a user