From 98468fab18e08de440f2f6731759d221fe08c416 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 27 Mar 2022 22:15:38 +0530 Subject: [PATCH] fix: ignore circular dependencies on barcode scan --- erpnext/public/js/controllers/transaction.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 61963925168..23c2bd405c1 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -404,11 +404,13 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } barcode(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - if(d.barcode=="" || d.barcode==null) { + const d = locals[cdt][cdn]; + if (!d.barcode) { // barcode cleared, remove item d.item_code = ""; } + // flag required for circular triggers + d._triggerd_from_barcode = true; this.item_code(doc, cdt, cdn); } @@ -429,7 +431,9 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe this.frm.doc.doctype === 'Delivery Note') { show_batch_dialog = 1; } - item.barcode = null; + if (!item._triggerd_from_barcode) { + item.barcode = null; + } if(item.item_code || item.barcode || item.serial_no) {