From b7e70bb746153a311bedb9613d7039c46d35ae2f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 20 Feb 2025 17:44:33 +0530 Subject: [PATCH] refactor: better error message --- erpnext/controllers/budget_controller.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/controllers/budget_controller.py b/erpnext/controllers/budget_controller.py index c166416ddff..a7401290237 100644 --- a/erpnext/controllers/budget_controller.py +++ b/erpnext/controllers/budget_controller.py @@ -270,12 +270,12 @@ class BudgetValidation: annual_diff = (existing_amt + current_amt) - budget_amt if annual_diff > 0: _msg = _( - "Annual Budget for Account {} against {} {} is {}. It will be exceeded by {}".format( + "Annual Budget for Account {} against {}: {} is {}. It will be exceeded by {}".format( frappe.bold(key[2]), frappe.bold(frappe.unscrub(key[0])), frappe.bold(key[1]), - frappe.bold(fmt_money(budget_amt, currency=currency)), frappe.bold(fmt_money(annual_diff, currency=currency)), + frappe.bold(fmt_money(budget_amt, currency=currency)), ) ) @@ -288,10 +288,12 @@ class BudgetValidation: monthly_diff = (existing_amt + current_amt) - acc_monthly_budget if monthly_diff > 0: _msg = _( - "Expenses have gone above accumulated monthly budget by {} for {}.
Configured accumulated limit is {}".format( + "Accumulated Monthly Budget for Account {} against {}: {} is {}. It will be exceeded by {}".format( + frappe.bold(key[2]), + frappe.bold(frappe.unscrub(key[0])), + frappe.bold(key[1]), + frappe.bold(fmt_money(acc_monthly_budget, currency=currency)), frappe.bold(fmt_money(monthly_diff, currency=currency)), - get_link_to_form("Budget", budget), - fmt_money(acc_monthly_budget, currency=currency), ) )