From 0ef7594536de86da77773fc34b23f094e8e92423 Mon Sep 17 00:00:00 2001 From: Shllokkk <140623894+Shllokkk@users.noreply.github.com> Date: Mon, 16 Mar 2026 20:01:39 +0530 Subject: [PATCH] Merge pull request #53223 from Shllokkk/dashboard-chart-fix Bank balance chart fix for payments dashboard --- .../account_balance_timeline.js | 9 ++++++++ .../account_balance_timeline.py | 21 +++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.js b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.js index 09846114ea2..f96f7af260a 100644 --- a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.js +++ b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.js @@ -17,6 +17,15 @@ frappe.dashboards.chart_sources["Account Balance Timeline"] = { fieldtype: "Link", options: "Account", reqd: 1, + default: locals[":Company"][frappe.defaults.get_user_default("Company")]["default_bank_account"], + get_query: () => { + return { + filters: { + account_type: "Bank", + is_group: 0, + }, + }; + }, }, ], }; diff --git a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py index 261e68ca015..2e070517b8f 100644 --- a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py +++ b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py @@ -37,21 +37,14 @@ def get( filters = frappe.parse_json(filters) or frappe.parse_json(chart.filters_json) account = filters.get("account") - filters.get("company") + company = filters.get("company") - if not account and chart_name: - frappe.throw( - _("Account is not set for the dashboard chart {0}").format( - get_link_to_form("Dashboard Chart", chart_name) - ) - ) - - if not frappe.db.exists("Account", account) and chart_name: - frappe.throw( - _("Account {0} does not exists in the dashboard chart {1}").format( - account, get_link_to_form("Dashboard Chart", chart_name) - ) - ) + if not company and not account: + frappe.throw(_("Company and account filters not set!")) + if not company: + frappe.throw(_("Company filter not set!")) + if not account: + frappe.throw(_("Account filter not set!")) if not to_date: to_date = nowdate()