refactor: use Singles table to get acc_frozen_upto and modifier during migration

This commit is contained in:
khushi8112
2025-12-01 13:40:51 +05:30
parent 4df20a3122
commit c7e7e02b5b
2 changed files with 15 additions and 3 deletions

View File

@@ -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