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

Hello Community!!!

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

?

@peterg @rucha_mahabal @umair

Hi Dipak,

I don’t believe the “Fetch From” setting will work on child doctypes. In any case, it’s not a great practice, for two reasons: (1) you’re reduplicating data, and (2) you’re counting on client-side event triggers to maintain valid data. The “Fetch From” tool is really meant as a convenience and nothing more.

I’d suggest approaching this a bit differently, but if you absolutely need data to be duplicated from Purchase Invoice → Purchase Invoice Items for some reason, the best practice would be to put it on the backend (either server scripts or the doctype controller’s validation method, perhaps).