Hi,
I’ve university “Program” that has “Majors” that is child table (majors_list - in DocType field) after that I’m creating “Study Plan” child table (study_plan - in DocType Field) I’ve a major field in study plan that I want to list from Majors above. Problem is when I link to Majors It list all of them without fliter which in the same Program.
This is custom script I’m using
frappe.ui.form.on("Majors", "majors", function(frm, cdt, cdn){
var child = locals[cdt][cdt],
grid_row = cur_frm.fields_dict['study_plan'].grid.grid_rows_by_docname[child.name],
field = frappe.utils.filter_dict(grid_row.docfields, {fieldname: "major_abbre"})[0];
field.get_query = function(){
return {
filters: { parent: child.major}
}
}
grid_row.refresh_field("major");
});
Can anyone told me what’s wrong with this script?