Child Table set value of SELECT field once the Link Doctype choosen

I got what i want from here…

this is the code:

cur_frm.cscript.operation_no = function(doc, cdt, cdn) {
var child = locals[cdt][cdn];
if(child.parentfield=="bom_operations") erpnext.bom.set_operation_no(doc);
}

erpnext.bom.set_operation_no = function(doc) {
var op_table = doc.bom_operations || [];
var operations = [];

for (var i=0, j=op_table.length; i<j; i++) {
	var op = op_table[i].operation_no;
	if (op && !inList(operations, op)) operations.push(op);
}

frappe.meta.get_docfield("BOM Item", "operation_no",
	cur_frm.docname).options = operations.join("\n");