fix:Sibling child table filtering for duplacacy on student form
This commit is contained in:
parent
5d58fe6367
commit
e89d521848
@ -31,8 +31,9 @@ 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 +41,21 @@ 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];
|
||||
if(!doc.__islocal) sibling_list.push(doc.student);
|
||||
|
||||
$.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]] };
|
||||
};
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user