fix: make filename more user-friendly
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
5a6bff9de7
commit
508e4d9ae3
1 changed files with 4 additions and 1 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue