Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions beams/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ beams.patches.delete_custom_fields #26-11-2024-1
[post_model_sync]
# Patches added in this section will be executed after doctypes are migrated
beams.patches.set_account_in_cost_subhead #14-02-20250
beams.patches.set_company_in_budget_template #20-02-2025
1 change: 1 addition & 0 deletions beams/patches/set_account_in_cost_subhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ def execute():
'company': default_company,
'default_account': cost_subhead_doc.account
})
cost_subhead_doc.flags.ignore_mandatory = True
cost_subhead_doc.save()
frappe.db.commit()
13 changes: 13 additions & 0 deletions beams/patches/set_company_in_budget_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import frappe

def execute():
budget_templates = frappe.get_all('Budget Template', pluck='name')
default_company = frappe.db.get_single_value('Global Defaults', 'default_company')

for budget_template in budget_templates:
budget_template_doc = frappe.get_doc('Budget Template', budget_template)
if not budget_template_doc.company:
budget_template_doc.company = default_company
budget_template_doc.flags.ignore_mandatory = True
budget_template_doc.save()
frappe.db.commit()