Handle IndexError if no data found
This commit is contained in:
parent
75fa6b3ee8
commit
0d7bd43367
@ -8,6 +8,7 @@ frappe.query_reports["TDS Computation Summary"] = {
|
|||||||
"fieldname":"company",
|
"fieldname":"company",
|
||||||
"label": __("Company"),
|
"label": __("Company"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"options": "Company",
|
||||||
"default": frappe.defaults.get_default('company')
|
"default": frappe.defaults.get_default('company')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -41,8 +41,10 @@ def get_result(filters):
|
|||||||
for supplier in filters.supplier:
|
for supplier in filters.supplier:
|
||||||
tds = frappe.get_doc("Tax Withholding Category", supplier.tax_withholding_category)
|
tds = frappe.get_doc("Tax Withholding Category", supplier.tax_withholding_category)
|
||||||
rate = [d.tax_withholding_rate for d in tds.rates if d.fiscal_year == filters.fiscal_year][0]
|
rate = [d.tax_withholding_rate for d in tds.rates if d.fiscal_year == filters.fiscal_year][0]
|
||||||
account = [d.account for d in tds.accounts if d.company == filters.company][0]
|
try:
|
||||||
|
account = [d.account for d in tds.accounts if d.company == filters.company][0]
|
||||||
|
except IndexError:
|
||||||
|
account = []
|
||||||
total_invoiced_amount, tds_deducted = get_invoice_and_tds_amount(supplier.name, account,
|
total_invoiced_amount, tds_deducted = get_invoice_and_tds_amount(supplier.name, account,
|
||||||
filters.company, filters.from_date, filters.to_date)
|
filters.company, filters.from_date, filters.to_date)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user