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"},