I am trying to pull the item details into the purchase order via a custom button, I have tried to copy the existing code into my custom app but there seems to be a small issue, basically the querying of the documents is fine but when I want to add data from the document, nothing seems to be happening.
Can anyone help me resolve this issue, link to the js and py file is enclosed below:
I am enclosing a GIF link for what I am trying to do but the item is not getting added and there is no error as well:
You can not use
map_current_doc as it is.
You need to fetch items from BOM selected in Production Order.
Production Order does not have items.
As @kolate_sambhaji suggested, you can not use mapper function for mapping parent to child doctype. You need to write a server side function to return item_code, warehouse, qty etc and then you should append those values in the item table in the callback function.
For sample code, you can refer erpnext/material_request.js at develop · frappe/erpnext · GitHub