fix: correct uom reflecting in sales order when fetching from barcode

This commit is contained in:
Nishka Gosalia
2026-01-06 12:51:47 +05:30
parent 582db48ca5
commit 3cc41cf643
2 changed files with 6 additions and 2 deletions

View File

@@ -555,10 +555,11 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
var item = frappe.get_doc(cdt, cdn); var item = frappe.get_doc(cdt, cdn);
var update_stock = 0, show_batch_dialog = 0; var update_stock = 0, show_batch_dialog = 0;
item.weight_per_unit = 0; item.weight_per_unit = 0;
item.weight_uom = ''; 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; item.conversion_factor = 0;
if(['Sales Invoice', 'Purchase Invoice'].includes(this.frm.doc.doctype)) { 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; show_batch_dialog = 0;
} }
item.barcode = null; item.barcode = null;

View File

@@ -404,6 +404,8 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner {
async set_barcode(row, barcode) { async set_barcode(row, barcode) {
if (barcode && frappe.meta.has_field(row.doctype, this.barcode_field)) { if (barcode && frappe.meta.has_field(row.doctype, this.barcode_field)) {
await frappe.model.set_value(row.doctype, row.name, this.barcode_field, barcode); await frappe.model.set_value(row.doctype, row.name, this.barcode_field, barcode);
} else {
row.barcode = barcode;
} }
} }