Merge pull request #4007 from anandpdoshi/setup-wizard-duplicate-entry

catch DuplicateEntryError in install_fixtures step of Setup Wizard
This commit is contained in:
Anand Doshi 2015-09-14 16:33:16 +05:30
commit 9345240ff1

View File

@ -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