From c7e7e02b5b5a43283c22502109a4fc9079393f04 Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Mon, 1 Dec 2025 13:40:51 +0530 Subject: [PATCH] refactor: use Singles table to get acc_frozen_upto and modifier during migration --- ...grate_account_freezing_settings_to_company.py | 16 ++++++++++++++-- erpnext/setup/doctype/company/company.py | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) 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 2801b1c9a65..60869fc3267 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,8 +2,20 @@ import frappe def execute(): - frozen_till = frappe.db.get_single_value("Accounts Settings", "acc_frozen_upto") - modifier = frappe.db.get_single_value("Accounts Settings", "frozen_accounts_modifier") + rows = frappe.db.sql( + """ + SELECT field, value + FROM `tabSingles` + WHERE doctype='Accounts Settings' + AND field IN ('acc_frozen_upto', 'frozen_accounts_modifier') + """, + as_dict=True, + ) + + values = {row["field"]: row["value"] for row in rows} + + frozen_till = values.get("acc_frozen_upto") + modifier = values.get("frozen_accounts_modifier") if not frozen_till and not modifier: return diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 52de3542c61..def469e4fa3 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -605,7 +605,7 @@ class Company(NestedSet): def validate_pending_reposts(self, old_doc): if old_doc and old_doc.accounts_frozen_till_date != self.accounts_frozen_till_date: if self.accounts_frozen_till_date: - check_pending_reposting(self.accounts_frozen_till_date) + check_pending_reposting(self.accounts_frozen_till_date, self.name) def set_default_accounts(self): default_accounts = {