Is it possible, using custom scripts, to automatically pull the oldest batch number for line items on stock entries for production orders?
This might be a good place to start: erpnext/get_item_details.py at develop · frappe/erpnext · GitHub
It is not so easy doing a custom script, but modify this to return both qty and last batch id as a dict. Let us know if you get stuck - ping someone on gitter