From d8c10bcedbb3f2ce71f98ee9eca24fbffd802fc2 Mon Sep 17 00:00:00 2001 From: Khushal Trivedi Date: Mon, 23 Dec 2019 18:38:11 +0530 Subject: [PATCH] fix:Sibling child table filtering for duplicate entry on student form (#19908) * fix: date validation on inpatient record, else condition removing on clinical prcd templ which is not req * fix:Pricing Rule error AttributeError: 'str' object has no attribute 'get' #19770 * fix:Pricing Rule error AttributeError: 'str' object has no attribute 'get' #19770 * fix: joining and relieving Date can be on same date as valid use case * fix-education: date of birth validation * fix:Sibling child table filtering for duplacacy on student form * fix:Sibling child table filtering for duplacacy on student form * fix:Sibling child table filtering for duplacacy on student form --- erpnext/education/doctype/student/student.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/erpnext/education/doctype/student/student.js b/erpnext/education/doctype/student/student.js index b6e741c4da..1936dcbd3e 100644 --- a/erpnext/education/doctype/student/student.js +++ b/erpnext/education/doctype/student/student.js @@ -31,7 +31,7 @@ frappe.ui.form.on('Student', { frappe.ui.form.on('Student Guardian', { guardians_add: function(frm){ frm.fields_dict['guardians'].grid.get_field('guardian').get_query = function(doc){ - var guardian_list = []; + let guardian_list = []; if(!doc.__islocal) guardian_list.push(doc.guardian); $.each(doc.guardians, function(idx, val){ if (val.guardian) guardian_list.push(val.guardian); @@ -40,3 +40,18 @@ frappe.ui.form.on('Student Guardian', { }; } }); + + +frappe.ui.form.on('Student Sibling', { + siblings_add: function(frm){ + frm.fields_dict['siblings'].grid.get_field('student').get_query = function(doc){ + let sibling_list = [frm.doc.name]; + $.each(doc.siblings, function(idx, val){ + if (val.student && val.studying_in_same_institute == 'YES') { + sibling_list.push(val.student); + } + }); + return { filters: [['Student', 'name', 'not in', sibling_list]] }; + }; + } +}); \ No newline at end of file