From 06f04cad3ea75bc0e513cd9b3f36e94cdbf94baa Mon Sep 17 00:00:00 2001 From: diptanilsaha Date: Sat, 16 Aug 2025 22:15:55 +0530 Subject: [PATCH] fix: use query builder instead of raw SQL in unset_existing_data (cherry picked from commit 7fa4ed6139dfb737995fe297e40f4f5440c748c3) --- .../chart_of_accounts_importer/chart_of_accounts_importer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py b/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py index 0846841e84c..39c4ed99258 100644 --- a/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py +++ b/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py @@ -448,9 +448,8 @@ def unset_existing_data(company): "Sales Taxes and Charges Template", "Purchase Taxes and Charges Template", ]: - frappe.db.sql( - f'''delete from `tab{doctype}` where `company`="%s"''' % (company) # nosec - ) + dt = frappe.qb.DocType(doctype) + frappe.qb.from_(dt).where(dt.company == company).delete().run() def set_default_accounts(company):