Mass Submit Sales Invoices (API)

Hello there brothers,

I fought a lot with Import tool to make a proof of concept, leaving a home made erp solution to migrate to ERPNext, i love REPNext till now btw, but i couldn’t do it successfully, so we made some python scripts to use API to import items and sales invoice, with some effort we made it, but now all sales invoice are in “draft” status, i would like to mass submit them,

Do you know a way of doing this through API or any other method?

Thanks,

Keep going!

for si in frappe.get_all("Sales Invoice", filters={"docstatus": 0}):
  si = frappe.get_doc("Sales Invoice", si.name) 
  si.submit()

Do share your migrations scripts if it can be useful for other users!

edit: with loop

1 Like

Hello rmehta,

Thx for your quick answer, our scripts are a little bit dirty, i will clean it a bit a i will upload it then.

I will test your suggestion right away.

PS: I use the the API through web with PyCurl

Here is the script using REST API through pycurl:

One thing, i did what you said, but invoices are still with draft status, i have to do some commit or something?

Thx Again

Yeah sorry you need to commit using

frappe.db.commit()
1 Like

Got it!

Thx, you rock!

Hello Guys,
Am try to integrate our own point of sales solution with ERPNEXT using

  • Imports GizmoFort.Connector.ERPNext.PublicInterfaces
  • Imports GizmoFort.Connector.ERPNext.PublicTypes
    API, so far am able to get item, customer, inventory, payment and standard pricing. Am also able to send Invoice to ERPNEXT but they are in draft state.

Can I use this customer script in ERPNEXT to post all draft invoices to submit? If yes can you please provide a full example of the customer script? Also at what point with the customer script be executed?