fix: batch self enrollment

This commit is contained in:
Jannat Patel
2024-01-25 15:45:27 +05:30
parent d3b3d85c84
commit fe791dc478

View File

@@ -11,6 +11,10 @@ class BatchStudent(Document):
@frappe.whitelist()
def enroll_batch(batch_name):
if frappe.db.exists(
"Batch Student", {"student": frappe.session.user, "parent": batch_name}
):
frappe.throw("You are already enrolled in this batch")
enrollment = frappe.new_doc("Batch Student")
enrollment.student = frappe.session.user
enrollment.parent = batch_name