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
This commit is contained in:
Khushal Trivedi 2019-12-23 18:38:11 +05:30 committed by Nabin Hait
parent 4f72c0b8b5
commit d8c10bcedb

View File

@ -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]] };
};
}
});