mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-03 05:28:27 +00:00
feat(patch): set total budget amount on budget doctype
This commit is contained in:
@@ -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
|
||||
|
||||
16
erpnext/patches/v16_0/set_total_budget_amount.py
Normal file
16
erpnext/patches/v16_0/set_total_budget_amount.py
Normal 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
|
||||
"""
|
||||
)
|
||||
Reference in New Issue
Block a user