diff --git a/frappe/utils/print_format.py b/frappe/utils/print_format.py index a74850b4dd..d811490649 100644 --- a/frappe/utils/print_format.py +++ b/frappe/utils/print_format.py @@ -83,6 +83,7 @@ def _download_multi_pdf( PDF: A PDF generated by the concatenation of the mentioned input docs """ + filename = "" import json @@ -94,6 +95,7 @@ def _download_multi_pdf( if not isinstance(doctype, dict): result = json.loads(name) total_docs = len(result) + filename = f"{doctype}_" # Concatenating pdf files for idx, ss in enumerate(result): @@ -123,6 +125,7 @@ def _download_multi_pdf( total_docs = sum([len(doctype[dt]) for dt in doctype]) count = 1 for doctype_name in doctype: + filename += f"{doctype_name}_" for doc_name in doctype[doctype_name]: try: pdf_writer = frappe.get_print( @@ -156,7 +159,7 @@ def _download_multi_pdf( _file = frappe.get_doc( { "doctype": "File", - "file_name": f"{task_id}.pdf", + "file_name": f"{filename}{task_id}.pdf", "content": merged_pdf.getvalue(), "is_private": 1, }