From b27b35e1aefcf6baf0ed704ff32866470a9617fe Mon Sep 17 00:00:00 2001 From: Khushi Rawat <142375893+khushi8112@users.noreply.github.com> Date: Fri, 13 Jun 2025 20:20:54 +0530 Subject: [PATCH] chore: migration patch for account freezing fields --- erpnext/patches.txt | 1 + ...ate_account_freezing_settings_to_company.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 erpnext/patches/v15_0/migrate_account_freezing_settings_to_company.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e2a77df8ce0..12836c95804 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -265,6 +265,7 @@ erpnext.patches.v16_0.create_company_custom_fields [post_model_sync] erpnext.patches.v15_0.rename_gross_purchase_amount_to_net_purchase_amount +erpnext.patches.v15_0.migrate_account_freezing_settings_to_company erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings') erpnext.patches.v14_0.update_posting_datetime_and_dropped_indexes #22-02-2024 diff --git a/erpnext/patches/v15_0/migrate_account_freezing_settings_to_company.py b/erpnext/patches/v15_0/migrate_account_freezing_settings_to_company.py new file mode 100644 index 00000000000..0ae7764f07c --- /dev/null +++ b/erpnext/patches/v15_0/migrate_account_freezing_settings_to_company.py @@ -0,0 +1,18 @@ +import frappe + + +def execute(): + accounts_settings = frappe.get_doc("Accounts Settings", "Accounts Settings") + + accounts_frozen_till_date = accounts_settings.acc_frozen_upto + frozen_accounts_modifier = accounts_settings.frozen_accounts_modifier + + for company in frappe.get_all("Company", pluck="name"): + frappe.db.set_value( + "Company", + company, + { + "accounts_frozen_till_date": accounts_frozen_till_date, + "role_allowed_for_frozen_entries": frozen_accounts_modifier, + }, + )