"Fetch From" parent field in child Doc Type does not work

I have added a custom field named ‘is_import_purchase’ which is of type Check in ‘Purchase Invoice’ Doc Type. And I want to automatically reflect this field from parent Doc Type in its child DocType which is Purchase Invoice Item . So I created a new field called is_import_purchase_item in the child Doc Type. I also set following value in ‘Fetch From’ property of this field:

parent. is_import_purchase

I was in a hope that it will get it’s value based on parent Doc Type document but did not work for me. What should I do to automatically reflect the value from parent DocType in its Child Doc Type.?

Image Attached:

@peterg Could you please help me here? Thanks.


Try to add this code in Client Script:
frappe.ui.form.on(“Purchase Invoice”, {
before_save: function(frm, cdt, cdn) {
if (frm.doc.is_import_purchase) {
$.each(frm.doc.items || [], function(i, row) {
frappe.model.set_value(row.doctype, row.name, ‘is_import_purchase_item’, frm.doc.is_import_purchase);