From a707c82c0c05c4634bc346c889c74fcbcc584f7d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2026 00:03:02 +0530 Subject: [PATCH] fix: allow non-admin roles to import chart of accounts (backport #57454) (#58060) Co-authored-by: Vishnu Priya Baskaran <145791817+ervishnucs@users.noreply.github.com> --- .../chart_of_accounts_importer.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 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 6a0958c7bb2..7cd489edc62 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 @@ -459,16 +459,12 @@ def unset_existing_data(company): frappe.db.set_value("Company", company, update_values, update_values) # remove accounts data from various doctypes - for doctype in [ - "Account", - "Party Account", - "Mode of Payment Account", - "Tax Withholding Account", - "Sales Taxes and Charges Template", - "Purchase Taxes and Charges Template", - ]: + for doctype in ["Account", "Sales Taxes and Charges Template", "Purchase Taxes and Charges Template"]: frappe.get_query(doctype, delete=True, filters={"company": company}, ignore_permissions=False).run() + for doctype in ["Party Account", "Mode of Payment Account", "Tax Withholding Account"]: + frappe.get_query(doctype, delete=True, filters={"company": company}, ignore_permissions=True).run() + def set_default_accounts(company): from erpnext.setup.doctype.company.company import install_country_fixtures