e-taxes settings is single doctype now

This commit is contained in:
Ali 2026-03-03 16:45:58 +04:00
parent 74bd74b7ba
commit d78781d9b8
1 changed files with 13 additions and 10 deletions

View File

@ -47,16 +47,19 @@ def backup_etaxes_settings():
if not frappe.db.table_exists("tabE-Taxes Settings"):
return
# Find the best record — ORM still works normally here
rows = frappe.db.sql(
"""
SELECT * FROM `tabE-Taxes Settings`
WHERE name != 'E-Taxes Settings'
ORDER BY is_default DESC, is_active DESC, modified DESC
LIMIT 1
""",
as_dict=True,
)
# Find the best record using raw SQL — ORM still works normally here,
# but we avoid referencing is_default/is_active which may have been dropped.
rows = None
for query in [
"SELECT * FROM `tabE-Taxes Settings` WHERE name != 'E-Taxes Settings' ORDER BY modified DESC LIMIT 1",
"SELECT * FROM `tabE-Taxes Settings` ORDER BY modified DESC LIMIT 1",
]:
try:
rows = frappe.db.sql(query, as_dict=True)
except Exception:
pass
if rows:
break
if not rows:
return