From 644e1817291ccfdc1ebe2685f333986ad62dba73 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Wed, 8 May 2019 16:17:31 +0530 Subject: [PATCH] feat: remove first row if empty --- erpnext/accounts/doctype/payment_order/payment_order.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erpnext/accounts/doctype/payment_order/payment_order.js b/erpnext/accounts/doctype/payment_order/payment_order.js index 61ead01747..a5e18e8097 100644 --- a/erpnext/accounts/doctype/payment_order/payment_order.js +++ b/erpnext/accounts/doctype/payment_order/payment_order.js @@ -31,6 +31,10 @@ frappe.ui.form.on('Payment Order', { }, get_from_payment_entry: function(frm) { + // remove if first row is empty + if (!frm.doc.references[0].reference_name) { + frm.doc.references = []; + } erpnext.utils.map_current_doc({ method: "erpnext.accounts.doctype.payment_entry.payment_entry.make_payment_order", source_doctype: "Payment Entry", @@ -42,11 +46,16 @@ frappe.ui.form.on('Payment Order', { get_query_filters: { bank: frm.doc.bank, docstatus: 1, + status: ["=", "Initiated"], } }); }, get_from_payment_request: function(frm) { + // remove if first row is empty + if (!frm.doc.references[0].reference_name) { + frm.doc.references = []; + } erpnext.utils.map_current_doc({ method: "erpnext.accounts.doctype.payment_request.payment_request.make_payment_order", source_doctype: "Payment Request",