mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 05:29:18 +00:00
[Fix] Auto add item in the cart if sinfle items found in the serach (#11072)
This commit is contained in:
committed by
Nabin Hait
parent
607b5d4985
commit
e0dfd1608e
@@ -948,6 +948,7 @@ class POSItems {
|
|||||||
if (this.search_index[search_term]) {
|
if (this.search_index[search_term]) {
|
||||||
const items = this.search_index[search_term];
|
const items = this.search_index[search_term];
|
||||||
this.render_items(items);
|
this.render_items(items);
|
||||||
|
this.set_item_in_the_cart(items);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (item_group == "All Item Groups") {
|
} else if (item_group == "All Item Groups") {
|
||||||
@@ -961,19 +962,32 @@ class POSItems {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.render_items(items);
|
this.render_items(items);
|
||||||
if(serial_no) {
|
this.set_item_in_the_cart(items, serial_no, batch_no);
|
||||||
this.events.update_cart(items[0].item_code,
|
|
||||||
'serial_no', serial_no);
|
|
||||||
this.reset_search_field();
|
|
||||||
}
|
|
||||||
if(batch_no) {
|
|
||||||
this.events.update_cart(items[0].item_code,
|
|
||||||
'batch_no', batch_no);
|
|
||||||
this.reset_search_field();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_item_in_the_cart(items, serial_no, batch_no) {
|
||||||
|
if (serial_no) {
|
||||||
|
this.events.update_cart(items[0].item_code,
|
||||||
|
'serial_no', serial_no);
|
||||||
|
this.reset_search_field();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (batch_no) {
|
||||||
|
this.events.update_cart(items[0].item_code,
|
||||||
|
'batch_no', batch_no);
|
||||||
|
this.reset_search_field();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (items.length === 1) {
|
||||||
|
this.events.update_cart(items[0].item_code,
|
||||||
|
'qty', '+1');
|
||||||
|
this.reset_search_field();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
reset_search_field() {
|
reset_search_field() {
|
||||||
this.search_field.set_value('');
|
this.search_field.set_value('');
|
||||||
this.search_field.$input.trigger("input");
|
this.search_field.$input.trigger("input");
|
||||||
|
|||||||
Reference in New Issue
Block a user