How to assign task depend upon purchase order

i need anyone guide me to create task based on when created purchase order(service) and asign to task for a vendor or supplier also how to automate item code in stock module.
Thanks to erpnext/frappe forum