[14.0][IMP] base_report_to_printer: Add Text render document to printer

This commit is contained in:
Denis Roussel
2021-12-20 10:50:03 +01:00
parent aed6d2cb17
commit af0f663caf

View File

@@ -160,3 +160,22 @@ class IrActionsReport(models.Model):
)
return document, doc_format
def _render_qweb_text(self, docids, data=None):
"""Generate a TEXT file and returns it.
If the action configured on the report is server, it prints the
generated document as well.
"""
document, doc_format = super()._render_qweb_text(docids=docids, data=data)
behaviour = self.behaviour()
printer = behaviour.pop("printer", None)
can_print_report = self._can_print_report(behaviour, printer, document)
if can_print_report:
printer.print_document(
self, document, doc_format=self.report_type, **behaviour
)
return document, doc_format