Try ERPNext Buy Support Partners Foundation

Copy field from parent to child doctype

Hi everyone,

I have a parent doctype with two fields and those fields are filled based on the selection of another field. I want to copy the two fields in the parent doctype to a child doctype. I can’t use the “cur_frm.add_fetch” method cause I just want to copy the fields right from the parent.

Is there anyway to do this?

Any help is appreciated.

Check below to copy value from parent to child

$.each(frm.doc.items || [], function(i, d) {
if(!d.delivery_date) d.delivery_date = frm.doc.delivery_date;
});
refresh_field(“items”);