From ce63ab760252a25029688ac4031d6d488d8514e3 Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Thu, 30 Nov 2017 07:08:53 +0100 Subject: [PATCH] Show Batch Selector Dialog Only If There Are Multiple Batches (#11794) * check if multiple batches available before showing dialog * Update point_of_sale.js --- erpnext/selling/page/point_of_sale/point_of_sale.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 c7745ab5bf..4cc4146c0c 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -168,7 +168,10 @@ erpnext.pos.PointOfSale = class PointOfSale { value = item.serial_no + '\n'+ value; } - if(field === 'qty' && (item.serial_no || item.batch_no)) { + // if actual_batch_qty and actual_qty if there is only one batch. In such + // a case, no point showing the dialog + if(field === 'qty' && (item.serial_no || item.batch_no) + && (item.actual_batch_qty != item.actual_qty)) { this.select_batch_and_serial_no(item); } else { this.update_item_in_frm(item, field, value) @@ -192,7 +195,10 @@ erpnext.pos.PointOfSale = class PointOfSale { .trigger('item_code', item.doctype, item.name) .then(() => { const show_dialog = item.has_serial_no || item.has_batch_no; - if (show_dialog && field == 'qty') { + + // if actual_batch_qty and actual_qty if then there is only one batch. In such + // a case, no point showing the dialog + if (show_dialog && field == 'qty' && (item.actual_batch_qty != item.actual_qty)) { // check has serial no/batch no and update cart this.select_batch_and_serial_no(item); } else { @@ -1498,4 +1504,4 @@ class Payment { this.dialog.set_value("paid_amount", this.frm.doc.paid_amount); this.dialog.set_value("outstanding_amount", this.frm.doc.outstanding_amount); } -} \ No newline at end of file +}