From 806f420ddd396819e6aa36fe36d6fbd3e1c28c8e Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 27 Mar 2022 22:06:45 +0530 Subject: [PATCH] fix: revert global flag added for erasing barcode This looked like a hack and doesn't even work anyway! how can row level barcode-item relation be maitnained on entire form? --- erpnext/public/js/controllers/transaction.js | 8 +------- erpnext/public/js/utils/barcode_scanner.js | 4 ---- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 914ae34885..6196392516 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -409,8 +409,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe // barcode cleared, remove item d.item_code = ""; } - - this.frm.from_barcode = this.frm.from_barcode ? this.frm.from_barcode + 1 : 1; this.item_code(doc, cdt, cdn); } @@ -431,11 +429,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe this.frm.doc.doctype === 'Delivery Note') { show_batch_dialog = 1; } - // clear barcode if setting item (else barcode will take priority) - if (this.frm.from_barcode == 0) { - item.barcode = null; - } - this.frm.from_barcode = this.frm.from_barcode - 1 >= 0 ? this.frm.from_barcode - 1 : 0; + item.barcode = null; if(item.item_code || item.barcode || item.serial_no) { diff --git a/erpnext/public/js/utils/barcode_scanner.js b/erpnext/public/js/utils/barcode_scanner.js index 57ce7b3a62..c6c3938eb4 100644 --- a/erpnext/public/js/utils/barcode_scanner.js +++ b/erpnext/public/js/utils/barcode_scanner.js @@ -118,10 +118,6 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner { } set_barcode(row, barcode) { - // increase qty and set scanned value and item in row - // XXX: tightly coupled global flag on frm object used in transaction.js -_- - this.frm.from_barcode = this.frm.from_barcode ? this.frm.from_barcode + 1 : 1; - if (barcode && frappe.meta.has_field(row.doctype, this.barcode_field)) { frappe.model.set_value(row.doctype, row.name, this.barcode_field, barcode); }