Stack on Save DocType with Child Table from client values

So guys, I creating a small tool that will help our wharehouse user.

I am near to the end of my quest, but stuck on how to take ‘Booked’ items and Create a `Purchase Receipt’

So far I only can create Batch value… but I am stack this Purchase Receipt that has a Child Table Items.

	def save(self):
		# For booked Items make a Purchase Receipt
		purchase_order = frappe.get_doc('Purchase Order', self.purchase_order)
		for item in self.booked:
			new_batch = frappe.get_doc({
					"doctype": "Batch",
					"batch_id": item.batch,
					"item": item.item_code,
					"quantity": item.quantity,
					"description": """
					 For Purchase Order: {0}
					 Created: {1}
					 Quantity: {2}
					""".format(self.purchase_order, frappe.utils.today(),
							   item.quantity)
			})
			new_batch.insert()
		print("Save it")

@kickapoo so where are you stuck?

I can’t create ‘on save’ the related Purchase Receipt based on my Booked Items Child Table. Right now I can create ‘on save’ only the Batch records.

Currently I am trying to see if from apps/erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py , make_purchase_receipt will help me