@whitelist call from server side scripting

I am trying to execute the whitelist function: erpnext.manufacturing.doctype.work_order.work_order.make_work_order(bom_no, item, qty=0, project=None, variant_items=None) from a custom server side script.

It is not working at all. Does not matter in what way I make the call, it just jams with TypeError: make_work_order() missing 2 required positional arguments: ‘bom_no’ and ‘item’

here is the code:

boms = frappe.get_list("BOM", filters=[["BOM Item","item_code","=",bom_item.item_code]], fields=["name", "item"], as_list = False)

if len(boms) == 1:
    parent_bom = boms[0]
    wo_name = frappe.call("erpnext.manufacturing.doctype.work_order.work_order.make_work_order", args = {
        "bom_no" : parent_bom.name,
        "item"   : parent_bom.item,
        "qty"    : bom_item.qty

The values in parent_bom are filled out, and qty has been checked and contains a value.

parent_bom = {'name': 'BOM-MAN-000', 'item': 'FISS-10'}, item.qty = 1

Hi @cuber,

perhaps, an issue in this line.

Please try it.

wo_name = frappe.call("erpnext.manufacturing.doctype.work_order.work_order.make_work_order", parent_bom.name, parent_bom.item, qty=bom_item.qty)

Thank You!

Turns out you have to do it this way in a Server Side Script:

wo = frappe.call('erpnext.manufacturing.doctype.work_order.work_order.make_work_order' , 
                bom_no = parent_bom.name,
                item   = parent_bom.item,
                qty    = bom_item.qty