Bench execute code

Could someone tell me what I am doing wrong here? I have like around 10,000 DOs that I am trying to submit via bench execute code. But nothing seem to happen, I get nothing on the console also. Any ideas what I am doing wrong?

def submit_do():
    for name in frappe.get_all("Delivery Note"):
        doc = frappe.get_doc("Delivery Note", name)
        if doc.docstatus == 0:



Does this print works?

what is this?

How you are executing?

print(doc) doesnt work.

doc.docstatus==0 checks if the document is in draft

doc.cancel() to cancel document

doc.submit() to submit the document.

I am executing it via bench command - bench execute

you cannot cancel a draft document.

1 Like