diff --git a/lms/lms/doctype/class_student/class_student.json b/lms/lms/doctype/class_student/class_student.json index 302f602f..6c6857af 100644 --- a/lms/lms/doctype/class_student/class_student.json +++ b/lms/lms/doctype/class_student/class_student.json @@ -7,30 +7,36 @@ "editable_grid": 1, "engine": "InnoDB", "field_order": [ - "class_student", - "student" + "student", + "student_name", + "username" ], "fields": [ { "fieldname": "student", "fieldtype": "Link", - "hidden": 1, + "in_list_view": 1, "label": "Student", - "options": "User" + "options": "User", + "reqd": 1 }, { - "fieldname": "class_student", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Class Student", - "options": "Class Student Registration", - "reqd": 1 + "fetch_from": "student.full_name", + "fieldname": "student_name", + "fieldtype": "Data", + "label": "Student Name" + }, + { + "fetch_from": "student.username", + "fieldname": "username", + "fieldtype": "Data", + "label": "Username" } ], "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2023-08-18 16:56:34.435008", + "modified": "2023-08-18 18:45:22.787839", "modified_by": "Administrator", "module": "LMS", "name": "Class Student", diff --git a/lms/lms/doctype/class_student_registration/__init__.py b/lms/lms/doctype/class_student_registration/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/lms/lms/doctype/class_student_registration/class_student_registration.js b/lms/lms/doctype/class_student_registration/class_student_registration.js deleted file mode 100644 index 15fa2b5e..00000000 --- a/lms/lms/doctype/class_student_registration/class_student_registration.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2023, Frappe and contributors -// For license information, please see license.txt - -frappe.ui.form.on("Class Student Registration", { - onload: function (frm) { - frm.set_query("member", function (doc) { - return { - filters: { - ignore_user_type: 1, - }, - }; - }); - }, -}); diff --git a/lms/lms/doctype/class_student_registration/class_student_registration.json b/lms/lms/doctype/class_student_registration/class_student_registration.json deleted file mode 100644 index 4e7ef27d..00000000 --- a/lms/lms/doctype/class_student_registration/class_student_registration.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "format:CLS-REG-{#####}", - "creation": "2023-08-18 15:46:54.616815", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "member", - "member_name", - "member_username", - "column_break_zrly", - "class_name", - "address", - "amount", - "currency" - ], - "fields": [ - { - "fieldname": "member", - "fieldtype": "Link", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Member", - "options": "User", - "reqd": 1 - }, - { - "fieldname": "address", - "fieldtype": "Link", - "label": "Address", - "options": "Address" - }, - { - "fieldname": "column_break_zrly", - "fieldtype": "Column Break" - }, - { - "fieldname": "amount", - "fieldtype": "Currency", - "label": "Amount" - }, - { - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "options": "Currency" - }, - { - "fetch_from": "member.username", - "fieldname": "member_username", - "fieldtype": "Data", - "label": "Member Username", - "read_only": 1 - }, - { - "fieldname": "class_name", - "fieldtype": "Link", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Class Name", - "options": "LMS Class" - }, - { - "fetch_from": "member.full_name", - "fieldname": "member_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Member Name", - "read_only": 1 - } - ], - "index_web_pages_for_search": 1, - "links": [], - "modified": "2023-08-18 16:40:01.740071", - "modified_by": "Administrator", - "module": "LMS", - "name": "Class Student Registration", - "naming_rule": "Expression", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "show_title_field_in_link": 1, - "sort_field": "modified", - "sort_order": "DESC", - "states": [], - "title_field": "member_name" -} \ No newline at end of file diff --git a/lms/lms/doctype/class_student_registration/class_student_registration.py b/lms/lms/doctype/class_student_registration/class_student_registration.py deleted file mode 100644 index 1555d33f..00000000 --- a/lms/lms/doctype/class_student_registration/class_student_registration.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023, Frappe and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - - -class ClassStudentRegistration(Document): - pass diff --git a/lms/lms/doctype/class_student_registration/test_class_student_registration.py b/lms/lms/doctype/class_student_registration/test_class_student_registration.py deleted file mode 100644 index 62e78c41..00000000 --- a/lms/lms/doctype/class_student_registration/test_class_student_registration.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023, Frappe and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestClassStudentRegistration(FrappeTestCase): - pass diff --git a/lms/patches.txt b/lms/patches.txt index dea5f0b6..9c3cda5c 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -62,4 +62,4 @@ execute:frappe.permissions.reset_perms("Course Evaluator") execute:frappe.permissions.reset_perms("LMS Certificate Request") execute:frappe.permissions.reset_perms("LMS Certificate Evaluation") lms.patches.v1_0.paid_certificate_to_paid_course #18-08-2023 -lms.patches.v1_0.create_class_student_registration #19-08-2023 \ No newline at end of file +lms.patches.v1_0.revert_class_registration #18-08-2023 \ No newline at end of file diff --git a/lms/patches/v1_0/revert_class_registration.py b/lms/patches/v1_0/revert_class_registration.py new file mode 100644 index 00000000..3da2b368 --- /dev/null +++ b/lms/patches/v1_0/revert_class_registration.py @@ -0,0 +1,23 @@ +import frappe + + +def execute(): + if frappe.db.exists("DocType", "Class Student Registration"): + frappe.reload_doc("lms", "doctype", "class_student") + + students = frappe.get_all("Class Student", fields=["name", "student"]) + for student in students: + student_details = frappe.db.get_value( + "User", student.student, ["full_name", "username"], as_dict=1 + ) + frappe.db.set_value( + "Class Student", + student.name, + { + "class_student": None, + "student_name": student_details.full_name, + "username": student_details.username, + }, + ) + + frappe.delete_doc("DocType", "Class Student Registration")