diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index a0f8598ef8..adde913fb6 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -990,18 +990,18 @@ class POSItems { } this.get_items({search_value: search_term, item_group }) - .then(({ items, serial_no, batch_no }) => { + .then(({ items, serial_no, batch_no, barcode }) => { if (search_term) { this.search_index[search_term] = items; } this.items = items; this.render_items(items); - this.set_item_in_the_cart(items, serial_no, batch_no); + this.set_item_in_the_cart(items, serial_no, batch_no, barcode); }); } - set_item_in_the_cart(items, serial_no, batch_no) { + set_item_in_the_cart(items, serial_no, batch_no, barcode) { if (serial_no) { this.events.update_cart(items[0].item_code, 'serial_no', serial_no); @@ -1016,7 +1016,7 @@ class POSItems { return; } - if (items.length === 1) { + if (items.length === 1 && (serial_no || batch_no || barcode)) { this.events.update_cart(items[0].item_code, 'qty', '+1'); this.reset_search_field(); diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py index 20b5bb05b6..8dad0a3515 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.py +++ b/erpnext/selling/page/point_of_sale/point_of_sale.py @@ -67,6 +67,11 @@ def get_items(start, page_length, price_list, item_group, search_value=""): 'batch_no': batch_no }) + if barcode: + res.update({ + 'barcode': barcode + }) + return res def get_conditions(item_code, serial_no, batch_no, barcode):