mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-04 14:08:29 +00:00
fix: patch to set budget distribution total
This commit is contained in:
@@ -451,3 +451,4 @@ erpnext.patches.v15_0.migrate_old_item_wise_tax_detail_data_to_table
|
|||||||
erpnext.patches.v16_0.migrate_budget_records_to_new_structure
|
erpnext.patches.v16_0.migrate_budget_records_to_new_structure
|
||||||
erpnext.patches.v16_0.update_currency_exchange_settings_for_frankfurter
|
erpnext.patches.v16_0.update_currency_exchange_settings_for_frankfurter
|
||||||
erpnext.patches.v16_0.migrate_account_freezing_settings_to_company
|
erpnext.patches.v16_0.migrate_account_freezing_settings_to_company
|
||||||
|
erpnext.patches.v16_0.populate_budget_distribution_total
|
||||||
11
erpnext/patches/v16_0/populate_budget_distribution_total.py
Normal file
11
erpnext/patches/v16_0/populate_budget_distribution_total.py
Normal 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)
|
||||||
Reference in New Issue
Block a user