feat(patch): set total budget amount on budget doctype

This commit is contained in:
khushi8112
2025-10-06 17:24:52 +05:30
parent b6e452a695
commit 906a4bd398
2 changed files with 17 additions and 1 deletions

View File

@@ -448,4 +448,4 @@ erpnext.patches.v16_0.update_serial_batch_entries
erpnext.patches.v16_0.set_company_wise_warehouses
erpnext.patches.v16_0.set_valuation_method_on_companies
erpnext.patches.v15_0.migrate_old_item_wise_tax_detail_data_to_table
erpnext.patches.v16_0.set_total_budget_amount

View File

@@ -0,0 +1,16 @@
import frappe
def execute():
if frappe.db.has_column("Budget", "total_budget_amount"):
frappe.db.sql(
"""
UPDATE `tabBudget` b
SET b.total_budget_amount = (
SELECT SUM(ba.budget_amount)
FROM `tabBudget Account` ba
WHERE ba.parent = b.name
)
WHERE IFNULL(b.total_budget_amount, 0) = 0
"""
)