From bfc6f44fb009b1ca0dd504078a82faebc7f18db0 Mon Sep 17 00:00:00 2001 From: HemilSangani Date: Mon, 11 May 2026 18:58:57 +0530 Subject: [PATCH 1/2] fix: add company filter to Budget Against dimension options (cherry picked from commit bdf0136fc50c5cc3f4dbd6b2710d1c2e90ebaa05) --- .../report/budget_variance_report/budget_variance_report.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js index c74450191aa..00f7ae85d46 100644 --- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js +++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js @@ -96,9 +96,12 @@ function get_filters() { if (!frappe.query_report.filters) return; let budget_against = frappe.query_report.get_filter_value("budget_against"); + let company = frappe.query_report.get_filter_value("company"); if (!budget_against) return; + // Branch does not have company field + const filters = budget_against !== "Branch" && company ? { company: company } : {}; - return frappe.db.get_link_options(budget_against, txt); + return frappe.db.get_link_options(budget_against, txt, filters); }, }, { From 3fb6437d2613a90275fe5b73092846f2f00c1b2c Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Wed, 3 Jun 2026 02:14:14 +0530 Subject: [PATCH 2/2] fix: move Company filter at the start (cherry picked from commit c34eeee0964a6002b010f844898b0007901861b0) --- .../budget_variance_report.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js index 00f7ae85d46..1bb9abd8c92 100644 --- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js +++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js @@ -38,6 +38,14 @@ function get_filters() { let budget_against_options = get_dimensions(); let filters = [ + { + fieldname: "company", + label: __("Company"), + fieldtype: "Link", + options: "Company", + default: frappe.defaults.get_user_default("Company"), + reqd: 1, + }, { fieldname: "from_fiscal_year", label: __("From Fiscal Year"), @@ -67,14 +75,6 @@ function get_filters() { default: "Yearly", reqd: 1, }, - { - fieldname: "company", - label: __("Company"), - fieldtype: "Link", - options: "Company", - default: frappe.defaults.get_user_default("Company"), - reqd: 1, - }, { fieldname: "budget_against", label: __("Budget Against"), @@ -98,7 +98,7 @@ function get_filters() { let budget_against = frappe.query_report.get_filter_value("budget_against"); let company = frappe.query_report.get_filter_value("company"); if (!budget_against) return; - // Branch does not have company field + const filters = budget_against !== "Branch" && company ? { company: company } : {}; return frappe.db.get_link_options(budget_against, txt, filters);