From e67fa424b209e2dbce9735923a671afbc7fc47d0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 11 Sep 2015 15:32:06 +0530 Subject: [PATCH] [fix] catch DuplicateEntryError in install_fixtures step of Setup Wizard --- erpnext/setup/page/setup_wizard/install_fixtures.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/page/setup_wizard/install_fixtures.py b/erpnext/setup/page/setup_wizard/install_fixtures.py index 02fa27fb59..ba48a29875 100644 --- a/erpnext/setup/page/setup_wizard/install_fixtures.py +++ b/erpnext/setup/page/setup_wizard/install_fixtures.py @@ -190,4 +190,14 @@ def install(country=None): parent_link_field = ("parent_" + scrub(doc.doctype)) if doc.meta.get_field(parent_link_field) and not doc.get(parent_link_field): doc.flags.ignore_mandatory = True - doc.insert(ignore_permissions=True) + + try: + doc.insert(ignore_permissions=True) + except frappe.DuplicateEntryError, 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 +