Server Script for Auto Invoice from Sales Delivery

I want to generate sales invoice automatically after the sales delivery validation. To achieve this I created the Server script as per attached screenshot. Server script is running without any errors but the sales Invoice is not getting generated.

Script Type : DocType Event
Reference Document Type: Delivery Note
DoctType Event: After Submit

Script:'erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice',source_name =

I need your to achieve this.

Thanks in advance.

1 Like

Hi @mangroliya,

Please apply a custom/client script and check it.

frappe.ui.form.on('Delivery Note', {
	on_submit(frm) {

When you submit the Delivery Note and automatically will open the sales invoice on a current page and then please click to save.

Thank You!

The below code is working. This code is creating Invoice automatically from delivery and same time submitting also.

facture ='erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice',source_name =
facture.docstatus = 1

facture_doc = frappe.get_doc(