fix(pstch): allow duplicate entries (#16632)
diff --git a/erpnext/patches/v11_0/create_department_records_for_each_company.py b/erpnext/patches/v11_0/create_department_records_for_each_company.py
index 1257f19..b5a7bd9 100644
--- a/erpnext/patches/v11_0/create_department_records_for_each_company.py
+++ b/erpnext/patches/v11_0/create_department_records_for_each_company.py
@@ -27,8 +27,10 @@
for company in companies:
copy_doc = frappe.copy_doc(department_doc)
copy_doc.update({"company": company.name})
- copy_doc.insert()
-
+ try:
+ copy_doc.insert()
+ except frappe.DuplicateEntryError:
+ pass
# append list of new department for each company
comp_dict[company.name][department.name] = copy_doc.name