Create Delivery Note from Sales Order (maped document)

Hi @Omar_Mohammed,

Please apply it.

frappe.db.insert({
    'doctype': 'Delivery Note',
	'customer': frm.doc.customer,
	'set_warehouse': frm.doc.set_warehouse,
	'selling_price_list': 'Standard Selling',
	'docstatus':1,
	'items': frm.doc.items.map((item) => {
	    return {
			'item_code' : item.item_code,
			'item_name' : item.item_name,
			'rate' : item.rate,
			'qty':item.qty,
			'against_sales_order': frm.doc.name,
			'so_detail': item.name
		};
	})
}).then(doc => {
	console.log(doc.name);
	frappe.show_alert("Delivery Note is created successfully");
});

The problem is that you have not added a so_detail.
I have tested it on my side so it’s worked perfectly.

Then reload and check it.

Thank You!

2 Likes