From 6397590f0755cea1881b2d562ecc8757cf011961 Mon Sep 17 00:00:00 2001 From: Saqib Date: Thu, 30 Apr 2020 11:04:51 +0530 Subject: [PATCH] fix: list index out of range error (#21468) * fix: list index out of range error * fix: condition --- .../gross_and_net_profit_report.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py index 260f35f270d..8ce745e4d6b 100644 --- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py @@ -35,6 +35,13 @@ def execute(filters=None): }) return columns, data + + # to avoid error eg: gross_income[0] : list index out of range + if not gross_income: + gross_income = [{}] + if not gross_expense: + gross_expense = [{}] + data.append({ "account_name": "'" + _("Included in Gross Profit") + "'", "account": "'" + _("Included in Gross Profit") + "'"