fix: generate pdf only when result exists

(cherry picked from commit f07f4ce86f)
This commit is contained in:
Gursheen Anand
2023-08-28 17:14:15 +05:30
committed by Mergify
parent 657ca7ff22
commit 53270dd933

View File

@@ -63,11 +63,6 @@ def get_report_pdf(doc, consolidated=True):
filters = get_common_filters(doc)
if doc.report == "General Ledger":
filters.update(get_gl_filters(doc, entry, tax_id, presentation_currency))
else:
filters.update(get_ar_filters(doc, entry))
if doc.report == "General Ledger":
col, res = get_soa(filters)
for x in [0, -2, -1]:
@@ -75,8 +70,11 @@ def get_report_pdf(doc, consolidated=True):
if len(res) == 3:
continue
else:
filters.update(get_ar_filters(doc, entry))
ar_res = get_ar_soa(filters)
col, res = ar_res[0], ar_res[1]
if not res:
continue
statement_dict[entry.customer] = get_html(doc, filters, entry, col, res, ageing)