From 7ae89dedd59815cc0dea63a3ecf67b2355ea4425 Mon Sep 17 00:00:00 2001 From: Devin Slauenwhite Date: Wed, 4 May 2022 11:06:16 -0400 Subject: [PATCH] fix: cleanup dont_allow_new_row logic --- erpnext/public/js/utils/barcode_scanner.js | 7 ++----- erpnext/stock/doctype/pick_list/pick_list.js | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/erpnext/public/js/utils/barcode_scanner.js b/erpnext/public/js/utils/barcode_scanner.js index c8a539d2eb..25b4f62217 100644 --- a/erpnext/public/js/utils/barcode_scanner.js +++ b/erpnext/public/js/utils/barcode_scanner.js @@ -11,10 +11,7 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner { this.batch_no_field = opts.batch_no_field || "batch_no"; this.qty_field = opts.qty_field || "qty"; this.max_qty_field = opts.max_qty_field || null; - this.allow_new_row = opts.allow_new_row; - if (this.allow_new_row === undefined || this.allow_new_row === null) { - this.allow_new_row = true; - } + this.dont_allow_new_row = opts.dont_allow_new_row; this.items_table_name = opts.items_table_name || "items"; this.items_table = this.frm.doc[this.items_table_name]; @@ -77,7 +74,7 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner { } if (!row) { - if (!this.allow_new_row) { + if (this.dont_allow_new_row) { frappe.show_alert({ message: __("Maximum quantity scanned for item {0}.", [item_code]), indicator: "red" diff --git a/erpnext/stock/doctype/pick_list/pick_list.js b/erpnext/stock/doctype/pick_list/pick_list.js index ba1475347a..70e530cbfe 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.js +++ b/erpnext/stock/doctype/pick_list/pick_list.js @@ -165,7 +165,7 @@ frappe.ui.form.on('Pick List', { items_table_name: 'locations', qty_field: 'picked_qty', max_qty_field: 'qty', - allow_new_row: false + dont_allow_new_row: true }; const barcode_scanner = new erpnext.utils.BarcodeScanner(opts); barcode_scanner.process_scan();