fix: dont attempt to init singles that dont exist
This is done during app install stage and causes unnecessary failures where stale doctypes are left in db.
This commit is contained in:
parent
1e64abe9a5
commit
82cc98366d
1 changed files with 9 additions and 2 deletions
|
|
@ -473,13 +473,20 @@ def set_all_patches_as_completed(app):
|
|||
|
||||
|
||||
def init_singles():
|
||||
singles = [single["name"] for single in frappe.get_all("DocType", filters={"issingle": True})]
|
||||
singles = frappe.get_all("DocType", filters={"issingle": True}, pluck="name")
|
||||
for single in singles:
|
||||
if not frappe.db.get_singles_dict(single):
|
||||
if frappe.db.get_singles_dict(single):
|
||||
continue
|
||||
|
||||
try:
|
||||
doc = frappe.new_doc(single)
|
||||
doc.flags.ignore_mandatory = True
|
||||
doc.flags.ignore_validate = True
|
||||
doc.save()
|
||||
except ImportError:
|
||||
# The doctype exists, but controller is deleted,
|
||||
# no need to attempt to init such single, ref: #16917
|
||||
continue
|
||||
|
||||
|
||||
def make_conf(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue