fix: patch to set budget distribution total

This commit is contained in:
khushi8112
2025-12-10 03:06:05 +05:30
parent f194ac093c
commit ed4c17d3a2
2 changed files with 13 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
import frappe
from frappe.utils import flt
def execute():
budgets = frappe.get_all("Budget", filters={"docstatus": ["in", [0, 1]]}, fields=["name"])
for b in budgets:
doc = frappe.get_doc("Budget", b.name)
total = sum(flt(row.amount) for row in doc.budget_distribution)
doc.db_set("budget_distribution_total", total, update_modified=False)