From 55e7c1a866b7071e4c77ac7ef99a6a17de7c23c8 Mon Sep 17 00:00:00 2001 From: scmmishra Date: Mon, 8 Oct 2018 15:20:45 +0530 Subject: [PATCH] api: create user account for student Co-authored-by: Chinmay Pai --- erpnext/education/api.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/erpnext/education/api.py b/erpnext/education/api.py index 30d55880732..b75635ee231 100644 --- a/erpnext/education/api.py +++ b/erpnext/education/api.py @@ -38,7 +38,18 @@ def enroll_student(source_name): program_enrollment.student = student.name program_enrollment.student_name = student.title program_enrollment.program = frappe.db.get_value("Student Applicant", source_name, "program") - frappe.publish_realtime('enroll_student_progress', {"progress": [4, 4]}, user=frappe.session.user) + frappe.publish_realtime('enroll_student_progress', {"progress": [4, 4]}, user=frappe.session.user) + student_user = frappe.get_doc({ + 'doctype':'User', + 'first_name': student.first_name, + 'email': student.student_email_id, + 'send_welcome_email': 1, + 'user_type': 'Website User' + }) + student_user.add_roles("Student", "LMS User") + student_user.save() + update_password_link = student_user.reset_password() + print(update_password_link) return program_enrollment