fix: Serial Nos not set in the row after scanning in popup

- Avoid whitspaces while calculating length of serial nos
This commit is contained in:
marination 2021-11-02 18:34:55 +05:30
parent 27cbeb920e
commit 734b57deec

View File

@ -206,8 +206,10 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
var me = this; var me = this;
var item = frappe.get_doc(cdt, cdn); var item = frappe.get_doc(cdt, cdn);
if (item.serial_no && item.qty === item.serial_no.split(`\n`).length) { // check if serial nos entered are as much as qty in row
return; if (item.serial_no) {
let serial_nos = item.serial_no.split(`\n`).filter(sn => sn.trim()); // filter out whitespaces
if (item.qty === serial_nos.length) return;
} }
if (item.serial_no && !item.batch_no) { if (item.serial_no && !item.batch_no) {