fix: Check root_type of Depreciation Expense Account
diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py
index 0c96b51..874fb63 100644
--- a/erpnext/assets/doctype/asset/depreciation.py
+++ b/erpnext/assets/doctype/asset/depreciation.py
@@ -135,27 +135,19 @@
 	return fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account
 
 def get_credit_and_debit_accounts(accumulated_depreciation_account, depreciation_expense_account):
-	if is_income_or_expense_account(depreciation_expense_account) == "Expense":
+	root_type = frappe.get_value("Account", depreciation_expense_account, "root_type")
+
+	if root_type == "Expense":
 		credit_account = accumulated_depreciation_account
 		debit_account = depreciation_expense_account
-	else:
+	elif root_type == "Income":
 		credit_account = depreciation_expense_account
 		debit_account = accumulated_depreciation_account
+	else:
+		frappe.throw(_("Depreciation Expense Account should be an Income or Expense Account."))
 
 	return credit_account, debit_account
 
-def is_income_or_expense_account(account):
-	from frappe.utils.nestedset import get_ancestors_of
-
-	ancestors = [ancestor.split(' - ')[0] for ancestor in get_ancestors_of("Account", account)]
-	if ancestors:
-		if "Expenses" in ancestors:
-			return "Expense"
-		elif "Income" in ancestors:
-			return "Income"
-
-	frappe.throw(_("Depreciation Expense Account should be an Income or Expense Account."))
-
 @frappe.whitelist()
 def scrap_asset(asset_name):
 	asset = frappe.get_doc("Asset", asset_name)