From 4b20e852eafca088398751354f0967f7f7b9f9a7 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 10 Mar 2020 10:36:05 +0530 Subject: [PATCH] fix: Get invoice details only if invoice is selected --- erpnext/accounts/doctype/c_form/c_form.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/c_form/c_form.js b/erpnext/accounts/doctype/c_form/c_form.js index 3d0fc0a42c..846408ff24 100644 --- a/erpnext/accounts/doctype/c_form/c_form.js +++ b/erpnext/accounts/doctype/c_form/c_form.js @@ -32,10 +32,12 @@ frappe.ui.form.on('C-Form Invoice Detail', { invoice_no(frm, cdt, cdn) { let d = frappe.get_doc(cdt, cdn); - frm.call('get_invoice_details', { - invoice_no: d.invoice_no - }).then(r => { - frappe.model.set_value(cdt, cdn, r.message); - }); + if (d.invoice_no) { + frm.call('get_invoice_details', { + invoice_no: d.invoice_no + }).then(r => { + frappe.model.set_value(cdt, cdn, r.message); + }); + } } });