Submitting docs using frappe python client or api

Good morning, i need to submit a sales order using (eventually) the python frappe client (GitHub - frappe/frappe-client: Python library to use Frappe API).
There is a submit function for docs but i cannot understand how it works, it wants a doclist as parameter, but everything i pass as parameter, the api responses that i haven’t passe any parameter.

Can someone help me?

Thank you

You need to progress through the docstatus just like you would in the UI. 0=draft, 1=submitted, 2=cancelled

from frappeclient import FrappeClient

client = FrappeClient("", "", "password")

    # Prepare a customer dict that we will use to create a new
# customer in ERPNext
doc = {"doctype": "Sales Order",
       # more required fields ...}

# create new record in ERPNext
# submit this record

thank you but i just tried id, i have ever the same error

TypeError: submit() takes exactly 1 argument (0 given)

i also tried to retrieve a doc (sales order) from erp and the submitting it alone, or creating a list and inserting it into the list, but i have ever the same error (the insert works well, the submit donesn’t)

This is a workaround, I’m sure there’s a better way to do it.

def submit_doctype(submit_this, this_status=None):
       doc = client.get_doc(submit_this, name=name["name"])
        if doc["docstatus"] == 0:
            doc["docstatus"] = 1
            if this_status is not None:

            print("Submit ", name["name"])
1 Like

it seems to work, thank you very much