From b6e452a695ed3a5734cfe0d5bfe23d9634206acb Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Mon, 6 Oct 2025 15:15:13 +0530 Subject: [PATCH] feat: show budget total --- erpnext/accounts/doctype/budget/budget.json | 29 ++++++++++++++++++--- erpnext/accounts/doctype/budget/budget.py | 5 ++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/budget/budget.json b/erpnext/accounts/doctype/budget/budget.json index fcd78691a03..5b62b7eec92 100644 --- a/erpnext/accounts/doctype/budget/budget.json +++ b/erpnext/accounts/doctype/budget/budget.json @@ -33,7 +33,11 @@ "action_if_annual_exceeded_on_cumulative_expense", "action_if_accumulated_monthly_exceeded_on_cumulative_expense", "section_break_21", - "accounts" + "accounts", + "section_break_hqka", + "column_break_gnot", + "column_break_ybiq", + "total_budget_amount" ], "fields": [ { @@ -188,7 +192,8 @@ }, { "fieldname": "section_break_21", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "hide_border": 1 }, { "fieldname": "accounts", @@ -232,13 +237,31 @@ "fieldtype": "Select", "label": "Action if Accumulative Monthly Budget Exceeded on Cumulative Expense", "options": "\nStop\nWarn\nIgnore" + }, + { + "fieldname": "section_break_hqka", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_gnot", + "fieldtype": "Column Break" + }, + { + "fieldname": "column_break_ybiq", + "fieldtype": "Column Break" + }, + { + "fieldname": "total_budget_amount", + "fieldtype": "Currency", + "label": "Total Budget Amount", + "read_only": 1 } ], "grid_page_length": 50, "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2025-06-16 15:57:13.114981", + "modified": "2025-10-06 14:55:07.247313", "modified_by": "Administrator", "module": "Accounts", "name": "Budget", diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py index a55c189f783..2472e813cd1 100644 --- a/erpnext/accounts/doctype/budget/budget.py +++ b/erpnext/accounts/doctype/budget/budget.py @@ -53,6 +53,7 @@ class Budget(Document): monthly_distribution: DF.Link | None naming_series: DF.Literal["BUDGET-.YYYY.-"] project: DF.Link | None + total_budget_amount: DF.Currency # end: auto-generated types def validate(self): @@ -62,6 +63,7 @@ class Budget(Document): self.validate_accounts() self.set_null_value() self.validate_applicable_for() + self.set_total_budget_amount() def validate_duplicate(self): budget_against_field = frappe.scrub(self.budget_against) @@ -139,6 +141,9 @@ class Budget(Document): ): self.applicable_on_booking_actual_expenses = 1 + def set_total_budget_amount(self): + self.total_budget_amount = flt(sum(d.budget_amount for d in self.accounts)) + def validate_expense_against_budget(args, expense_amount=0): args = frappe._dict(args)