From 3cc41cf643aca0bfacdf6dc3b302432ddabea5b5 Mon Sep 17 00:00:00 2001 From: Nishka Gosalia Date: Tue, 6 Jan 2026 12:51:47 +0530 Subject: [PATCH] fix: correct uom reflecting in sales order when fetching from barcode --- erpnext/public/js/controllers/transaction.js | 6 ++++-- erpnext/public/js/utils/barcode_scanner.js | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 1b23042769e..7abdbe75fd5 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -555,10 +555,11 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe var item = frappe.get_doc(cdt, cdn); var update_stock = 0, show_batch_dialog = 0; - item.weight_per_unit = 0; item.weight_uom = ''; - item.uom = null // make UOM blank to update the existing UOM when item changes + if(!item.barcode){ + item.uom = null // make UOM blank to update the existing UOM when item changes + } item.conversion_factor = 0; if(['Sales Invoice', 'Purchase Invoice'].includes(this.frm.doc.doctype)) { @@ -574,6 +575,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe show_batch_dialog = 0; } + item.barcode = null; diff --git a/erpnext/public/js/utils/barcode_scanner.js b/erpnext/public/js/utils/barcode_scanner.js index 822a9902a38..9f83f04b53f 100644 --- a/erpnext/public/js/utils/barcode_scanner.js +++ b/erpnext/public/js/utils/barcode_scanner.js @@ -404,6 +404,8 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner { async set_barcode(row, barcode) { if (barcode && frappe.meta.has_field(row.doctype, this.barcode_field)) { await frappe.model.set_value(row.doctype, row.name, this.barcode_field, barcode); + } else { + row.barcode = barcode; } }