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 index 0ae7764f07c..2801b1c9a65 100644 --- a/erpnext/patches/v15_0/migrate_account_freezing_settings_to_company.py +++ b/erpnext/patches/v15_0/migrate_account_freezing_settings_to_company.py @@ -2,17 +2,18 @@ import frappe def execute(): - accounts_settings = frappe.get_doc("Accounts Settings", "Accounts Settings") + frozen_till = frappe.db.get_single_value("Accounts Settings", "acc_frozen_upto") + modifier = frappe.db.get_single_value("Accounts Settings", "frozen_accounts_modifier") - accounts_frozen_till_date = accounts_settings.acc_frozen_upto - frozen_accounts_modifier = accounts_settings.frozen_accounts_modifier + if not frozen_till and not modifier: + return 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, + "accounts_frozen_till_date": frozen_till, + "role_allowed_for_frozen_entries": modifier, }, )