refactor: remove dead duplicate code
diff --git a/erpnext/education/setup.py b/erpnext/education/setup.py
index b716926..663f1ca 100644
--- a/erpnext/education/setup.py
+++ b/erpnext/education/setup.py
@@ -3,7 +3,6 @@
 
 
 import frappe
-from erpnext.setup.utils import insert_record
 
 
 def setup_education():
@@ -13,6 +12,21 @@
 		return
 	create_academic_sessions()
 
+
+def insert_record(records):
+	for r in records:
+		doc = frappe.new_doc(r.get("doctype"))
+		doc.update(r)
+		try:
+			doc.insert(ignore_permissions=True)
+		except frappe.DuplicateEntryError as e:
+			# pass DuplicateEntryError and continue
+			if e.args and e.args[0]==doc.doctype and e.args[1]==doc.name:
+				# make sure DuplicateEntryError is for the exact same doc and not a related doc
+				pass
+			else:
+				raise
+
 def create_academic_sessions():
 	data = [
 		{"doctype": "Academic Year", "academic_year_name": "2015-16"},
diff --git a/erpnext/setup/setup_wizard/data/test_mfg.json b/erpnext/setup/setup_wizard/data/test_mfg.json
deleted file mode 100644
index efc5fa8..0000000
--- a/erpnext/setup/setup_wizard/data/test_mfg.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "add_sample_data": 1,
- "bank_account": "HDFC",
- "company_abbr": "FT",
- "company_name": "For Testing",
- "company_tagline": "Just for GST",
- "country": "India",
- "currency": "INR",
- "customer_1": "Test Customer 1",
- "customer_2": "Test Customer 2",
- "domains": ["Manufacturing"],
- "email": "great@example.com",
- "full_name": "Great Tester",
- "fy_end_date": "2018-03-31",
- "fy_start_date": "2017-04-01",
- "is_purchase_item_1": 1,
- "is_purchase_item_2": 1,
- "is_purchase_item_3": 0,
- "is_purchase_item_4": 0,
- "is_purchase_item_5": 0,
- "is_sales_item_1": 1,
- "is_sales_item_2": 1,
- "is_sales_item_3": 1,
- "is_sales_item_4": 1,
- "is_sales_item_5": 1,
- "item_1": "Test Item 1",
- "item_2": "Test Item 2",
- "item_group_1": "Products",
- "item_group_2": "Products",
- "item_group_3": "Products",
- "item_group_4": "Products",
- "item_group_5": "Products",
- "item_uom_1": "Unit",
- "item_uom_2": "Unit",
- "item_uom_3": "Unit",
- "item_uom_4": "Unit",
- "item_uom_5": "Unit",
- "language": "English (United States)",
- "password": "test",
- "setup_website": 1,
- "supplier_1": "Test Supplier 1",
- "supplier_2": "Test Supplier 2",
- "timezone": "Asia/Kolkata",
- "user_accountant_1": 1,
- "user_accountant_2": 1,
- "user_accountant_3": 1,
- "user_accountant_4": 1,
- "user_purchaser_1": 1,
- "user_purchaser_2": 1,
- "user_purchaser_3": 1,
- "user_purchaser_4": 1,
- "user_sales_1": 1,
- "user_sales_2": 1,
- "user_sales_3": 1,
- "user_sales_4": 1
-}
\ No newline at end of file
diff --git a/erpnext/setup/setup_wizard/utils.py b/erpnext/setup/setup_wizard/utils.py
deleted file mode 100644
index f1ec50af..0000000
--- a/erpnext/setup/setup_wizard/utils.py
+++ /dev/null
@@ -1,12 +0,0 @@
-import json
-import os
-
-from frappe.desk.page.setup_wizard.setup_wizard import setup_complete
-
-
-def complete():
-	with open(os.path.join(os.path.dirname(__file__),
-		'data', 'test_mfg.json'), 'r') as f:
-		data = json.loads(f.read())
-
-	setup_complete(data)
diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py
index a4f2207..98b1fef 100644
--- a/erpnext/setup/utils.py
+++ b/erpnext/setup/utils.py
@@ -5,24 +5,13 @@
 import frappe
 from frappe import _
 from frappe.utils import add_days, flt, get_datetime_str, nowdate
+from frappe.utils.nestedset import get_ancestors_of, get_root_of  # noqa
 
+# required for backward compatibility
+from frappe.utils.nestedset import get_ancestors_of, get_root_of  # noqa
 from erpnext import get_default_company
 
 
-def get_root_of(doctype):
-	"""Get root element of a DocType with a tree structure"""
-	result = frappe.db.sql_list("""select name from `tab%s`
-		where lft=1 and rgt=(select max(rgt) from `tab%s` where docstatus < 2)""" %
-		(doctype, doctype))
-	return result[0] if result else None
-
-def get_ancestors_of(doctype, name):
-	"""Get ancestor elements of a DocType with a tree structure"""
-	lft, rgt = frappe.db.get_value(doctype, name, ["lft", "rgt"])
-	result = frappe.db.sql_list("""select name from `tab%s`
-		where lft<%s and rgt>%s order by lft desc""" % (doctype, "%s", "%s"), (lft, rgt))
-	return result or []
-
 def before_tests():
 	frappe.clear_cache()
 	# complete setup if missing
@@ -142,8 +131,6 @@
 	add_all_roles_to('Administrator')
 
 def set_defaults_for_tests():
-	from frappe.utils.nestedset import get_root_of
-
 	selling_settings = frappe.get_single("Selling Settings")
 	selling_settings.customer_group = get_root_of("Customer Group")
 	selling_settings.territory = get_root_of("Territory")