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