How to create and submit a purchase receipt when a purchase order is submitted auto

Reference:

When submitting the Sales Order then automatically submit the Delivery Note so you have to same logic apply for purchase.