mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
feat: show budget total
This commit is contained in:
@@ -33,7 +33,11 @@
|
|||||||
"action_if_annual_exceeded_on_cumulative_expense",
|
"action_if_annual_exceeded_on_cumulative_expense",
|
||||||
"action_if_accumulated_monthly_exceeded_on_cumulative_expense",
|
"action_if_accumulated_monthly_exceeded_on_cumulative_expense",
|
||||||
"section_break_21",
|
"section_break_21",
|
||||||
"accounts"
|
"accounts",
|
||||||
|
"section_break_hqka",
|
||||||
|
"column_break_gnot",
|
||||||
|
"column_break_ybiq",
|
||||||
|
"total_budget_amount"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -188,7 +192,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "section_break_21",
|
"fieldname": "section_break_21",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break",
|
||||||
|
"hide_border": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "accounts",
|
"fieldname": "accounts",
|
||||||
@@ -232,13 +237,31 @@
|
|||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Action if Accumulative Monthly Budget Exceeded on Cumulative Expense",
|
"label": "Action if Accumulative Monthly Budget Exceeded on Cumulative Expense",
|
||||||
"options": "\nStop\nWarn\nIgnore"
|
"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,
|
"grid_page_length": 50,
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-06-16 15:57:13.114981",
|
"modified": "2025-10-06 14:55:07.247313",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Budget",
|
"name": "Budget",
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class Budget(Document):
|
|||||||
monthly_distribution: DF.Link | None
|
monthly_distribution: DF.Link | None
|
||||||
naming_series: DF.Literal["BUDGET-.YYYY.-"]
|
naming_series: DF.Literal["BUDGET-.YYYY.-"]
|
||||||
project: DF.Link | None
|
project: DF.Link | None
|
||||||
|
total_budget_amount: DF.Currency
|
||||||
# end: auto-generated types
|
# end: auto-generated types
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
@@ -62,6 +63,7 @@ class Budget(Document):
|
|||||||
self.validate_accounts()
|
self.validate_accounts()
|
||||||
self.set_null_value()
|
self.set_null_value()
|
||||||
self.validate_applicable_for()
|
self.validate_applicable_for()
|
||||||
|
self.set_total_budget_amount()
|
||||||
|
|
||||||
def validate_duplicate(self):
|
def validate_duplicate(self):
|
||||||
budget_against_field = frappe.scrub(self.budget_against)
|
budget_against_field = frappe.scrub(self.budget_against)
|
||||||
@@ -139,6 +141,9 @@ class Budget(Document):
|
|||||||
):
|
):
|
||||||
self.applicable_on_booking_actual_expenses = 1
|
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):
|
def validate_expense_against_budget(args, expense_amount=0):
|
||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
|
|||||||
Reference in New Issue
Block a user