From 984acb661d4314960bf2f1eb3542830b182441cc Mon Sep 17 00:00:00 2001 From: ljain112 Date: Fri, 13 Sep 2024 17:30:52 +0530 Subject: [PATCH] fix: prevent KeyError by checking `report_filter` existence (cherry picked from commit c1d2cc2c14da36508ef1cd72f0ae04c961c1edbf) --- erpnext/patches/v14_0/update_reports_with_range.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/patches/v14_0/update_reports_with_range.py b/erpnext/patches/v14_0/update_reports_with_range.py index 2bda265ca66..014fba883fc 100644 --- a/erpnext/patches/v14_0/update_reports_with_range.py +++ b/erpnext/patches/v14_0/update_reports_with_range.py @@ -30,6 +30,9 @@ def update_report_json(report): report_json = json.loads(report.json) report_filter = report_json.get("filters") + if not report_filter: + return + keys_to_pop = [key for key in report_filter if key.startswith("range")] report_filter["range"] = ", ".join(str(report_filter.pop(key)) for key in keys_to_pop)