[fix] catch DuplicateEntryError in install_fixtures step of Setup Wizard

This commit is contained in:
Anand Doshi 2015-09-11 15:32:06 +05:30
parent 1c2636e7b3
commit e67fa424b2

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