From 88570379717e16a2a6f7b6aac6687f78c05e245e Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Wed, 15 Oct 2025 01:38:46 +0530 Subject: [PATCH] feat: flexible budget allocation frequency --- erpnext/accounts/doctype/budget/budget.json | 16 +++++++++++++++- erpnext/accounts/doctype/budget/budget.py | 9 ++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/budget/budget.json b/erpnext/accounts/doctype/budget/budget.json index bae88b9ffc5..129ecd31be8 100644 --- a/erpnext/accounts/doctype/budget/budget.json +++ b/erpnext/accounts/doctype/budget/budget.json @@ -19,6 +19,8 @@ "account", "distribution_type", "allocation_frequency", + "budget_start_date", + "budget_end_date", "section_break_6", "applicable_on_material_request", "action_if_annual_budget_exceeded_on_mr", @@ -286,6 +288,18 @@ "options": "Amount\nPercent", "reqd": 1 }, + { + "fieldname": "budget_start_date", + "fieldtype": "Date", + "label": "Budget Start Date", + "reqd": 1 + }, + { + "fieldname": "budget_end_date", + "fieldtype": "Date", + "label": "Budget End Date", + "reqd": 1 + }, { "default": "Monthly", "fieldname": "allocation_frequency", @@ -299,7 +313,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2025-10-13 16:15:53.046278", + "modified": "2025-10-15 01:20:30.551362", "modified_by": "Administrator", "module": "Accounts", "name": "Budget", diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py index 3c7e2b04b8d..0c4cb18087d 100644 --- a/erpnext/accounts/doctype/budget/budget.py +++ b/erpnext/accounts/doctype/budget/budget.py @@ -2,10 +2,12 @@ # For license information, please see license.txt +from datetime import date + import frappe from frappe import _ from frappe.model.document import Document -from frappe.utils import add_months, flt, fmt_money, get_last_day, getdate +from frappe.utils import add_months, flt, fmt_money, get_last_day, getdate, month_diff from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( get_accounting_dimensions, @@ -33,6 +35,7 @@ class Budget(Document): from erpnext.accounts.doctype.budget_account.budget_account import BudgetAccount from erpnext.accounts.doctype.budget_distribution.budget_distribution import BudgetDistribution + account: DF.Link accounts: DF.Table[BudgetAccount] action_if_accumulated_monthly_budget_exceeded: DF.Literal["", "Stop", "Warn", "Ignore"] action_if_accumulated_monthly_budget_exceeded_on_mr: DF.Literal["", "Stop", "Warn", "Ignore"] @@ -42,6 +45,7 @@ class Budget(Document): action_if_annual_budget_exceeded_on_mr: DF.Literal["", "Stop", "Warn", "Ignore"] action_if_annual_budget_exceeded_on_po: DF.Literal["", "Stop", "Warn", "Ignore"] action_if_annual_exceeded_on_cumulative_expense: DF.Literal["", "Stop", "Warn", "Ignore"] + allocation_frequency: DF.Literal["Monthly", "Quarterly", "Half-Yearly", "Yearly", "Date Range"] amended_from: DF.Link | None applicable_on_booking_actual_expenses: DF.Check applicable_on_cumulative_expense: DF.Check @@ -49,8 +53,11 @@ class Budget(Document): applicable_on_purchase_order: DF.Check budget_against: DF.Literal["", "Cost Center", "Project"] budget_distribution: DF.Table[BudgetDistribution] + budget_end_date: DF.Date + budget_start_date: DF.Date company: DF.Link cost_center: DF.Link | None + distribution_type: DF.Literal["Amount", "Percent"] fiscal_year: DF.Link monthly_distribution: DF.Link | None naming_series: DF.Literal["BUDGET-.YYYY.-"]