From 0047fcf7adb0c6f5c8a0a4b8c236890095bb11e6 Mon Sep 17 00:00:00 2001 From: abhijitkumbharIND Date: Mon, 17 Feb 2020 18:08:09 +0530 Subject: [PATCH] fix: HSN/SAC Error while creating a new item and not selecting the field. #20590 --- erpnext/stock/doctype/item/item.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index dd3248baf2d..735f35f36fe 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -137,7 +137,7 @@ frappe.ui.form.on("Item", { }, gst_hsn_code: function(frm) { - if(!frm.doc.taxes || !frm.doc.taxes.length) { + if((!frm.doc.taxes || !frm.doc.taxes.length) && frm.doc.gst_hsn_code) { frappe.db.get_doc("GST HSN Code", frm.doc.gst_hsn_code).then(hsn_doc => { $.each(hsn_doc.taxes || [], function(i, tax) { let a = frappe.model.add_child(cur_frm.doc, 'Item Tax', 'taxes');