fix: reload course doctype

This commit is contained in:
Jannat Patel
2023-08-18 17:38:20 +05:30
parent 3dcb55f603
commit bddd4743a7
10 changed files with 172 additions and 22 deletions

View File

@@ -7,39 +7,30 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"student",
"student_name",
"username"
"class_student",
"student"
],
"fields": [
{
"fieldname": "student",
"fieldtype": "Link",
"in_list_view": 1,
"hidden": 1,
"label": "Student",
"options": "User",
"reqd": 1
"options": "User"
},
{
"fetch_from": "student.full_name",
"fieldname": "student_name",
"fieldtype": "Data",
"fieldname": "class_student",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Student Name",
"read_only": 1
},
{
"fetch_from": "student.username",
"fieldname": "username",
"fieldtype": "Data",
"label": "Username",
"read_only": 1
"label": "Class Student",
"options": "Class Student Registration",
"reqd": 1
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2022-11-15 11:13:39.410578",
"modified": "2023-08-18 16:56:34.435008",
"modified_by": "Administrator",
"module": "LMS",
"name": "Class Student",

View File

@@ -0,0 +1,14 @@
// 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,
},
};
});
},
});

View File

@@ -0,0 +1,102 @@
{
"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"
}

View File

@@ -0,0 +1,9 @@
# 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

View File

@@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe and Contributors
# See license.txt
# import frappe
from frappe.tests.utils import FrappeTestCase
class TestClassStudentRegistration(FrappeTestCase):
pass

View File

@@ -3,10 +3,10 @@
frappe.ui.form.on("LMS Class", {
onload: function (frm) {
frm.set_query("student", "students", function (doc) {
frm.set_query("class_student", "students", function (doc) {
return {
filters: {
ignore_user_type: 1,
class_name: doc.name,
},
};
});

View File

@@ -61,4 +61,5 @@ execute:frappe.permissions.reset_perms("LMS Class")
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
lms.patches.v1_0.paid_certificate_to_paid_course #18-08-2023
lms.patches.v1_0.create_class_student_registration #19-08-2023

View 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)

View File

@@ -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"]},