fix: Set student email id mandatory only if skip user creation is disabled

This commit is contained in:
Rucha Mahabal 2020-09-07 19:46:53 +05:30
parent af1c4ba443
commit 06f89a1b94
4 changed files with 272 additions and 1201 deletions

View File

@ -3,15 +3,15 @@
frappe.ui.form.on('Student', {
setup: function(frm) {
frm.add_fetch("guardian", "guardian_name", "guardian_name");
frm.add_fetch("student", "title", "full_name");
frm.add_fetch("student", "gender", "gender");
frm.add_fetch("student", "date_of_birth", "date_of_birth");
frm.add_fetch('guardian', 'guardian_name', 'guardian_name');
frm.add_fetch('student', 'title', 'full_name');
frm.add_fetch('student', 'gender', 'gender');
frm.add_fetch('student', 'date_of_birth', 'date_of_birth');
frm.set_query("student", "siblings", function(doc, cdt, cdn) {
frm.set_query('student', 'siblings', function(doc, cdt, cdn) {
return {
"filters": {
"name": ["!=", doc.name]
'filters': {
'name': ['!=', doc.name]
}
};
})
@ -25,6 +25,12 @@ frappe.ui.form.on('Student', {
{party_type:'Student', party:frm.doc.name});
});
}
frappe.db.get_value('Education Settings', {name: 'Education Settings'}, 'user_creation_skip', (r) => {
if (r.user_creation_skip === "0") {
frm.set_df_property('student_email_id', 'reqd', 1);
}
});
}
});

View File

@ -102,7 +102,6 @@
"fieldtype": "Data",
"in_global_search": 1,
"label": "Student Email Address",
"reqd": 1,
"unique": 1
},
{
@ -255,7 +254,7 @@
],
"image_field": "image",
"links": [],
"modified": "2020-07-23 18:14:06.366442",
"modified": "2020-09-07 19:28:08.914568",
"modified_by": "Administrator",
"module": "Education",
"name": "Student",

View File

@ -7,7 +7,7 @@ frappe.ui.form.on("Student Applicant", {
},
refresh: function(frm) {
if(frm.doc.application_status== "Applied" && frm.doc.docstatus== 1 ) {
if (frm.doc.application_status==="Applied" && frm.doc.docstatus===1 ) {
frm.add_custom_button(__("Approve"), function() {
frm.set_value("application_status", "Approved");
frm.save_or_update();
@ -20,10 +20,11 @@ frappe.ui.form.on("Student Applicant", {
}, 'Actions');
}
if(frm.doc.application_status== "Approved" && frm.doc.docstatus== 1 ) {
if (frm.doc.application_status === "Approved" && frm.doc.docstatus === 1) {
frm.add_custom_button(__("Enroll"), function() {
frm.events.enroll(frm)
}).addClass("btn-primary");
frm.add_custom_button(__("Reject"), function() {
frm.set_value("application_status", "Rejected");
frm.save_or_update();
@ -35,7 +36,13 @@ frappe.ui.form.on("Student Applicant", {
frappe.hide_msgprint(true);
frappe.show_progress(__("Enrolling student"), data.progress[0],data.progress[1]);
}
})
});
frappe.db.get_value("Education Settings", {name: "Education Settings"}, "user_creation_skip", (r) => {
if (r.user_creation_skip === "0") {
frm.set_df_property("student_email_id", "reqd", 1);
}
});
},
enroll: function(frm) {