fix: reload course doctype
This commit is contained in:
23
lms/patches/v1_0/create_class_student_registration.py
Normal file
23
lms/patches/v1_0/create_class_student_registration.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("lms", "doctype", "class_student")
|
||||
frappe.reload_doc("lms", "doctype", "class_student_registration")
|
||||
|
||||
students = frappe.get_all(
|
||||
"Class Student", {"parent": ["is", "set"]}, ["name", "student", "parent"]
|
||||
)
|
||||
|
||||
for student in students:
|
||||
student_details = frappe.db.get_value(
|
||||
"User", student.student, ["full_name", "username"], as_dict=1
|
||||
)
|
||||
registration = frappe.new_doc("Class Student Registration")
|
||||
registration.member = student.student
|
||||
registration.member_name = student_details.full_name
|
||||
registration.member_username = student_details.username
|
||||
registration.class_name = student.parent
|
||||
registration.save()
|
||||
|
||||
frappe.db.set_value("Class Student", student.name, "class_student", registration.name)
|
||||
@@ -2,6 +2,7 @@ import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("lms", "doctype", "lms_course")
|
||||
courses = frappe.get_all(
|
||||
"LMS Course",
|
||||
{"paid_certificate": ["is", "set"]},
|
||||
|
||||
Reference in New Issue
Block a user