fix: show alert when maximum qty scanned is reached
This commit is contained in:
parent
159cf2848e
commit
ceffbf243e
@ -11,6 +11,10 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner {
|
||||
this.batch_no_field = opts.batch_no_field || "batch_no";
|
||||
this.qty_field = opts.qty_field || "qty";
|
||||
this.max_qty_field = opts.max_qty_field || null;
|
||||
this.allow_new_row = opts.allow_new_row;
|
||||
if (this.allow_new_row === undefined || this.allow_new_row === null) {
|
||||
this.allow_new_row = true;
|
||||
}
|
||||
|
||||
this.items_table_name = opts.items_table_name || "items";
|
||||
this.items_table = this.frm.doc[this.items_table_name];
|
||||
@ -73,6 +77,15 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner {
|
||||
}
|
||||
|
||||
if (!row) {
|
||||
if (!this.allow_new_row) {
|
||||
frappe.show_alert({
|
||||
message: __("Maximum quantity scanned for this barcode."),
|
||||
indicator: "red"
|
||||
});
|
||||
this.clean_up();
|
||||
return;
|
||||
}
|
||||
|
||||
// add new row if new item/batch is scanned
|
||||
row = frappe.model.add_child(this.frm.doc, cur_grid.doctype, this.items_table_name);
|
||||
// trigger any row add triggers defined on child table.
|
||||
|
Loading…
Reference in New Issue
Block a user