Mimic PO/SO items childtable auto-update behavior

Hello!
I created a childtable, ‘Production Table’ doctype that’s linked to another doctype, ‘Job Card’. Production table has a linked field to Operation and I want to mimic the behavior of the Sales Order Items/Purchase Order Items such that everytime I change the ‘Operation’ linked field in Production Table, I want the rest of the fields in child table row to update based on the Operation it is linked to.

It’s similar to how PO/SO items change their cost, description and other fields when item_code is changed. Is this possible to replicate in another doctype?

Thanks!

I figured it out. :smiley:

I can just get add a trigger for “operation_name”, use frappe.model.get_value to return the operation name, retrieve the operation data using frappe.client.get and update the values using frappe.model.set. :slight_smile:

	op_name = frappe.model.get_value(cdt, cdn, "operation_name");
	//console.log(op_name);
	//Use frappe.call to get operation values. 
	//set values using frappe.model.set_value(cdt, cdn, "fieldname", value);
});```

This post can now be closed. :laughing: