fix: cleanup dont_allow_new_row logic

This commit is contained in:
Devin Slauenwhite 2022-05-04 11:06:16 -04:00
parent 5560ceca62
commit 7ae89dedd5
2 changed files with 3 additions and 6 deletions

View File

@ -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"

View File

@ -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();