diff --git a/community/patches/v0_0/rename_chapters_and_lessons_doctype.py b/community/patches/v0_0/rename_chapters_and_lessons_doctype.py index 0086a14f..82d45556 100644 --- a/community/patches/v0_0/rename_chapters_and_lessons_doctype.py +++ b/community/patches/v0_0/rename_chapters_and_lessons_doctype.py @@ -7,8 +7,11 @@ def execute(): frappe.reload_doc("lms", "doctype", "chapter_reference") frappe.reload_doc("lms", "doctype", "lesson_reference") - move_chapters() - move_lessons() + if not frappe.db.count("Chapter Reference"): + move_chapters() + + if not frappe.db.count("Lesson Reference"): + move_lessons() def move_chapters(): docs = frappe.get_all("Chapters", fields=["*"])