From 48418eadb04c6687c938a13aa1557d5bd6bb4051 Mon Sep 17 00:00:00 2001 From: Mohd Haris Date: Sun, 5 Jul 2026 18:06:43 +0530 Subject: [PATCH] fix(budget-variance): correct month shift in comparison chart The Budget Variance Report chart plotted the actual expense one month earlier than the table (e.g. July actual shown under June). build_comparison_chart_data() collected budget columns using fieldname.startswith("budget_"). The dimension column "budget_against" also matches that prefix, so it was added as an extra leading entry to budget_fields and labels, while actual_fields had no such leading entry. This shifted every actual value one position ahead of its label. Skip the "budget_against" dimension column so budget/actual values and labels stay aligned per month. Co-Authored-By: Claude Opus 4.8 --- .../budget_variance_report/budget_variance_report.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py index cf4d32416c4..22e1e6854d7 100644 --- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py +++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py @@ -422,6 +422,11 @@ def build_comparison_chart_data(filters, columns, data): if not fieldname: continue + # skip the dimension column ("budget_against"), it only matches the + # "budget_" prefix by coincidence and would shift the actual values by one + if fieldname == "budget_against": + continue + if fieldname.startswith("budget_"): budget_fields.append(fieldname) elif fieldname.startswith("actual_"): @@ -433,7 +438,7 @@ def build_comparison_chart_data(filters, columns, data): labels = [ col["label"].replace("Budget", "").strip() for col in columns - if col.get("fieldname", "").startswith("budget_") + if col.get("fieldname", "").startswith("budget_") and col.get("fieldname") != "budget_against" ] budget_values = [0] * len(budget_fields)