fix: generate pdf only when result exists

This commit is contained in:
Gursheen Anand 2023-08-28 17:14:15 +05:30
parent 5c2a949593
commit f07f4ce86f

View File

@ -64,11 +64,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]:
@ -76,8 +71,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)