[IMP] report_carbone : make print_report_name work
This commit is contained in:
@@ -651,7 +651,7 @@ class IrActionsReportCarbone(models.Model):
|
||||
else:
|
||||
_logger.info("The PDF documents %r are now saved in the database", attachment_names)
|
||||
|
||||
def _render_carbone(self, report_ref, docids: str | list, data=None) -> tuple[bytes, str]:
|
||||
def _render_carbone(self, report_ref, docids: str | list, data=None) -> tuple[bytes, str, str | bool]:
|
||||
context = dict(self.env.context)
|
||||
|
||||
report_sudo = self._get_report(report_ref)
|
||||
@@ -676,13 +676,14 @@ class IrActionsReportCarbone(models.Model):
|
||||
streams_to_dl = list(stream_to_ids.keys())
|
||||
|
||||
if not context.get("from_ir_report_controller") or len(streams_to_dl) == 1:
|
||||
pdf_content = streams_to_dl[0].getvalue()
|
||||
# stream_to_ids[streams_to_dl[0]] contains [record_id, filename, extension]
|
||||
extension = stream_to_ids[streams_to_dl[0]][2]
|
||||
return pdf_content, extension
|
||||
stream = streams_to_dl[0]
|
||||
pdf_content = stream.getvalue()
|
||||
filename = stream_to_ids[stream][1]
|
||||
extension = stream_to_ids[stream][2]
|
||||
return pdf_content, extension, filename
|
||||
|
||||
zip_content = _build_zip_from_data(stream_to_ids)
|
||||
return zip_content, "zip"
|
||||
return zip_content, "zip", f"{report_sudo.name}.zip"
|
||||
|
||||
def _retrieve_carbone_filename(self, records, output_file_extension: str) -> str:
|
||||
self.ensure_one()
|
||||
|
||||
Reference in New Issue
Block a user