fix: reload course doctype
This commit is contained in:
@@ -7,39 +7,30 @@
|
|||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"student",
|
"class_student",
|
||||||
"student_name",
|
"student"
|
||||||
"username"
|
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldname": "student",
|
"fieldname": "student",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 1,
|
"hidden": 1,
|
||||||
"label": "Student",
|
"label": "Student",
|
||||||
"options": "User",
|
"options": "User"
|
||||||
"reqd": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "student.full_name",
|
"fieldname": "class_student",
|
||||||
"fieldname": "student_name",
|
"fieldtype": "Link",
|
||||||
"fieldtype": "Data",
|
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Student Name",
|
"label": "Class Student",
|
||||||
"read_only": 1
|
"options": "Class Student Registration",
|
||||||
},
|
"reqd": 1
|
||||||
{
|
|
||||||
"fetch_from": "student.username",
|
|
||||||
"fieldname": "username",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"label": "Username",
|
|
||||||
"read_only": 1
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2022-11-15 11:13:39.410578",
|
"modified": "2023-08-18 16:56:34.435008",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Class Student",
|
"name": "Class Student",
|
||||||
|
|||||||
@@ -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,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -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"
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
frappe.ui.form.on("LMS Class", {
|
frappe.ui.form.on("LMS Class", {
|
||||||
onload: function (frm) {
|
onload: function (frm) {
|
||||||
frm.set_query("student", "students", function (doc) {
|
frm.set_query("class_student", "students", function (doc) {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
ignore_user_type: 1,
|
class_name: doc.name,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -61,4 +61,5 @@ execute:frappe.permissions.reset_perms("LMS Class")
|
|||||||
execute:frappe.permissions.reset_perms("Course Evaluator")
|
execute:frappe.permissions.reset_perms("Course Evaluator")
|
||||||
execute:frappe.permissions.reset_perms("LMS Certificate Request")
|
execute:frappe.permissions.reset_perms("LMS Certificate Request")
|
||||||
execute:frappe.permissions.reset_perms("LMS Certificate Evaluation")
|
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
|
||||||
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():
|
def execute():
|
||||||
|
frappe.reload_doc("lms", "doctype", "lms_course")
|
||||||
courses = frappe.get_all(
|
courses = frappe.get_all(
|
||||||
"LMS Course",
|
"LMS Course",
|
||||||
{"paid_certificate": ["is", "set"]},
|
{"paid_certificate": ["is", "set"]},
|
||||||
|
|||||||
Reference in New Issue
Block a user