Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions posnext/fixtures/custom_field.json
Original file line number Diff line number Diff line change
Expand Up @@ -2590,7 +2590,7 @@
"dt": "POS Profile",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "custom_add_reference_details",
"fieldname": "custom_auto_search_serial_number",
"fieldtype": "Check",
"hidden": 0,
"hide_border": 0,
Expand All @@ -2602,16 +2602,16 @@
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "custom_product_bundle",
"insert_after": "custom_add_reference_details",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Add Reference Details",
"label": "Auto search serial number",
"length": 0,
"link_filters": null,
"mandatory_depends_on": null,
"modified": "2025-03-14 22:29:05.863641",
"modified": "2025-04-22 12:55:58.587952",
"module": "Posnext",
"name": "POS Profile-custom_add_reference_details",
"name": "POS Profile-custom_auto_search_serial_number",
"no_copy": 0,
"non_negative": 0,
"options": null,
Expand Down
10 changes: 3 additions & 7 deletions posnext/public/js/pos_item_selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ posnext.PointOfSale.ItemSelector = class {
this.hide_images = settings.hide_images;
this.reload_status = reload_status
this.auto_add_item = settings.auto_add_item_to_cart;
this.auto_search_serial = settings.custom_auto_search_serial_number;
if(settings.custom_default_view){
view = settings.custom_default_view
}
Expand Down Expand Up @@ -812,9 +813,7 @@ posnext.PointOfSale.ItemSelector = class {
const items = this.search_index[search_term];
this.items = items;
this.render_item_list(items);
this.auto_add_item && this.items.length == 1;
// Automatically add item to cart if only one item is found
if (this.items.length === 1) {
if (this.auto_search_serial && this.items.length === 1) {
this.add_filtered_item_to_cart();
}
return;
Expand All @@ -823,16 +822,13 @@ posnext.PointOfSale.ItemSelector = class {

this.get_items({ search_term })
.then(({ message }) => {
// eslint-disable-next-line no-unused-vars
const { items, serial_no, batch_no, barcode } = message;
if (search_term && !barcode) {
this.search_index[search_term] = items;
}
this.items = items;
this.render_item_list(items);
this.auto_add_item && this.items.length == 1;
// Automatically add item to cart if only one item is found
if (this.items.length === 1) {
if (this.auto_search_serial && this.items.length === 1) {
this.add_filtered_item_to_cart();
}
});
Expand Down
Loading