mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 21:59:13 +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():
|
def execute():
|
||||||
frozen_till = frappe.db.get_single_value("Accounts Settings", "acc_frozen_upto")
|
rows = frappe.db.sql(
|
||||||
modifier = frappe.db.get_single_value("Accounts Settings", "frozen_accounts_modifier")
|
"""
|
||||||
|
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:
|
if not frozen_till and not modifier:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -605,7 +605,7 @@ class Company(NestedSet):
|
|||||||
def validate_pending_reposts(self, old_doc):
|
def validate_pending_reposts(self, old_doc):
|
||||||
if old_doc and old_doc.accounts_frozen_till_date != self.accounts_frozen_till_date:
|
if old_doc and old_doc.accounts_frozen_till_date != self.accounts_frozen_till_date:
|
||||||
if 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):
|
def set_default_accounts(self):
|
||||||
default_accounts = {
|
default_accounts = {
|
||||||
|
|||||||
Reference in New Issue
Block a user