diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py index 52fe3cd148c..553f8d8d9d5 100644 --- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py +++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py @@ -72,10 +72,8 @@ class FiscalYear(Document): if existing_fiscal_years: for existing in existing_fiscal_years: - company_for_existing = frappe.db.sql_list( - """select company from `tabFiscal Year Company` - where parent=%s""", - existing.name, + company_for_existing = frappe.get_all( + "Fiscal Year Company", filters={"parent": existing.name}, pluck="company" ) overlap = False