From 07c83246d0e76ed40f8590dc92ff81be95e7a43b Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Wed, 10 Dec 2025 03:06:05 +0530 Subject: [PATCH] fix: patch to set budget distribution total (cherry picked from commit ed4c17d3a20df5c83eea2b67e4ec06dbc51183cb) # Conflicts: # erpnext/patches.txt --- erpnext/patches.txt | 6 ++++++ .../v16_0/populate_budget_distribution_total.py | 11 +++++++++++ 2 files changed, 17 insertions(+) create mode 100644 erpnext/patches/v16_0/populate_budget_distribution_total.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 74f6e8a275b..5eba5fe2711 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -449,3 +449,9 @@ 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.migrate_budget_records_to_new_structure +<<<<<<< HEAD +======= +erpnext.patches.v16_0.update_currency_exchange_settings_for_frankfurter +erpnext.patches.v16_0.migrate_account_freezing_settings_to_company +erpnext.patches.v16_0.populate_budget_distribution_total +>>>>>>> ed4c17d3a2 (fix: patch to set budget distribution total) diff --git a/erpnext/patches/v16_0/populate_budget_distribution_total.py b/erpnext/patches/v16_0/populate_budget_distribution_total.py new file mode 100644 index 00000000000..033fb968b4f --- /dev/null +++ b/erpnext/patches/v16_0/populate_budget_distribution_total.py @@ -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)