mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-24 00:58:29 +00:00
refactor: use Singles table to get acc_frozen_upto and modifier during migration
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user