Generate and complete production orders based on delivery notes

Im using the manufactoring module, with erpnext 12. However, I mainly use if to capture the BOM system wise, and have some custom scripts calculating position and stuff based on the order and po book.

I currently do not make production orders and do not wish to do that at the moment manually.

What I would like to do is generate, either monthly, or as a script when the delivery note is submitted, automatically a production order and complete it, for the corresponding items. This to make sure it posts to stock forcorrect positions on the subitems.

What would you experts advice in this regard?

Would it make sense to do it through the rest api, write a custom function (though im not familiar yet with how to go about this), or would there be other approaches?

My thought currently was to run a nightly cron to do it for all items delivered previous day, and create them through the api. Very much interested in your guys advice though.