ERP Customization with Auto-filling

Hi,

I have began using the Customization Forms to make new fields in my Material Request Item.

I now have fields that have an additional checkbox for shipping and another to calculate the total.


How do I make these customized values tied into forms generated?

Example:

After creating a Material Request with my new fields (amounts2 and shipping) and selecting a Purchase Order, the details of the item_code and qty are auto-filled into the child form.

How do I also auto-fill the amounts2 and shipping fields to make my Purchase Order have the same fields?

I think I need to pull information from the Material Request #, but I am unsure of where this value is set or how to find where it is stored.

Please let me know if you need any information.

refer here https://erpnext.org/docs/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples