Show Batch Selector Dialog Only If There Are Multiple Batches (#11794)

* check if multiple batches available before showing dialog

* Update point_of_sale.js
This commit is contained in:
tundebabzy 2017-11-30 07:08:53 +01:00 committed by Nabin Hait
parent 8ae53cacc5
commit ce63ab7602

View File

@ -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);
}
}
}