From 1a7e438fb250754fa8e6110ec7b0e3e6532e05c4 Mon Sep 17 00:00:00 2001 From: sahil28297 <37302950+sahil28297@users.noreply.github.com> Date: Mon, 11 Feb 2019 15:53:04 +0530 Subject: [PATCH] fix(pstch): allow duplicate entries (#16632) --- .../v11_0/create_department_records_for_each_company.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 1257f1918b..b5a7bd91bd 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 @@ def execute(): 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