diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index 297012d78fe..2df5634132d 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -223,7 +223,9 @@ erpnext.SerialNoBatchSelector = Class.extend({ frappe.model.set_value(row.doctype, row.name, 'batch_no', batch_no); } else { row = this.frm.doc.items.find(i => i.batch_no === batch_no); - frappe.model.set_value(row.doctype, row.name, 'batch_no', batch_no); + if (row) { + frappe.model.set_value(row.doctype, row.name, 'batch_no', batch_no); + } } if (!row) { @@ -272,7 +274,9 @@ erpnext.SerialNoBatchSelector = Class.extend({ frappe.model.set_value(row.doctype, row.name, 'batch_no', batch_no); } else { row = this.frm.doc.items.find(i => i.batch_no === batch_no); - frappe.model.set_value(row.doctype, row.name, 'batch_no', batch_no); + if (row) { + frappe.model.set_value(row.doctype, row.name, 'batch_no', batch_no); + } } const values = { 'qty': serial_no.length, diff --git a/erpnext/stock/doctype/batch/batch.js b/erpnext/stock/doctype/batch/batch.js index 15a0a351aa0..c44f23f2dae 100644 --- a/erpnext/stock/doctype/batch/batch.js +++ b/erpnext/stock/doctype/batch/batch.js @@ -10,7 +10,7 @@ frappe.ui.form.on('Batch', { 'is_stock_item': 1, 'has_batch_no': 1 } - } + }; }; frm.set_query('selling_price', function() {