From 4092ead41ecbf1713fb5b577ab2ade1a1630fa45 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Fri, 29 Mar 2019 16:19:04 +0530 Subject: [PATCH] fix: fetch account only if available --- .../report/tds_payable_monthly/tds_payable_monthly.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py index e55c022452..8ca466e4b8 100644 --- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py @@ -55,12 +55,15 @@ def get_result(filters): supplier = supplier_map[d] tds_doc = tds_docs[supplier.tax_withholding_category] - account = [i.account for i in tds_doc.accounts if i.company == filters.company][0] + account_list = [i.account for i in tds_doc.accounts if i.company == filters.company] + + if account_list: + account = account_list[0] for k in gle_map[d]: if k.party == supplier_map[d] and k.credit > 0: total_amount_credited += k.credit - elif k.account == account and k.credit > 0: + elif account_list and k.account == account and k.credit > 0: tds_deducted = k.credit total_amount_credited += k.credit