How to push data from Child Table Doctype to Other Doctype


I want to push Data from Purchase Receipt Item childtable to Batch Doctype as shown in this image :

I am trying this but it is not working right now :

frappe.ui.form.on(‘Batch’, {
refresh(frm) {
var crp = frappe.db.get_value(‘Purchase Receipt Item’, {‘parent’: doc.reference_name,‘item_code’: doc.item }, ‘crop_type’);
frm.set_value(‘crop_type’, crp);

Can somebody help me?

Thank you!