I want to perform Quality Inspection for all items that i procure, and for the quality inspection i have the label and the options.
i fetch the label from options from Quality Checks DocType, I am able to fetch the Quality check parameters for each quality attribute in an array. now when i assign the array to the df attribute, it assigns it to all the rows which i dont want. I want to assign different values to each row of options.
Currently the options in each row get assigned to the values of last Quality Check Attribute.
Here is the complete custom script
cur_frm.add_fetch(‘item_code’,‘item_group’,‘item_group’);
frappe.ui.form.on(“Quality Inspection”, “item_group”, function(frm) {
frappe.model.with_doc(“Item Group”, frm.doc.item_group, function() {
var tabletransfer= frappe.model.get_doc(“Item Group”, frm.doc.item_group);
var df = frappe.meta.get_docfield(“Quality Inspection Reading”,“options”, cur_frm.doc.name);
$.each(tabletransfer.quality_parameters, function(index, row){
d = frm.add_child(“readings”);
d.specification = row.specification;
var q_options = [];
frappe.model.with_doc(“Quality Checks”, row.specification, function() {
var optiontable= frappe.model.get_doc(“Quality Checks”, row.specification);
$.each(optiontable.quality_check_option, function(index_child, row_child){
q_options.push(row_child.options);
});
df.options = q_options;
q_options = null;
});
cur_frm.refresh_field(“readings”);
});
});
});