refactor: replace dead duplicate code
This commit is contained in:
parent
9daea6fa6c
commit
e401ad3f90
@ -155,18 +155,9 @@ def set_defaults_for_tests():
|
|||||||
|
|
||||||
|
|
||||||
def insert_record(records):
|
def insert_record(records):
|
||||||
for r in records:
|
from frappe.desk.page.setup_wizard.setup_wizard import make_records
|
||||||
doc = frappe.new_doc(r.get("doctype"))
|
|
||||||
doc.update(r)
|
make_records(records)
|
||||||
try:
|
|
||||||
doc.insert(ignore_permissions=True, ignore_if_duplicate=True)
|
|
||||||
except frappe.DuplicateEntryError as 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
|
|
||||||
|
|
||||||
def welcome_email():
|
def welcome_email():
|
||||||
site_name = get_default_company() or "ERPNext"
|
site_name = get_default_company() or "ERPNext"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user