I am attempting to create Work Orders programmatically using the rest-api. I am using the white listed function, make_work_orders in sales_order.py.
This function’s first parameter is called “items”. Tracing through the javascript that ERPNext uses to call this function… It looks like items are generated in the non-whitelisted function in sales_order.py called get_work_order_items.
Does anyone know how to go about creating work orders from a sales order using the rest-api without custom scripting or changes to the source code?
After a bit of digging I’ve found that it looks like I can compose the “items” object myself from the bom_item and sales_order_item doctypes for the given item_id, but it seems that I would just be duplicating the efforts of the get_work_order_items function. Is there a reason that function is not whitelisted? My original question stands as far as doing this with simple API calls without manipulating JSON myself… I don’t mind doing so if that’s the only way, but I’m attempting to make my interactions with ERPNext as simple as possible for continued maintenance of code.