diff --git a/posnext/fixtures/custom_field.json b/posnext/fixtures/custom_field.json index 1dad5dc..dbfcf25 100644 --- a/posnext/fixtures/custom_field.json +++ b/posnext/fixtures/custom_field.json @@ -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, @@ -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, diff --git a/posnext/public/js/pos_item_selector.js b/posnext/public/js/pos_item_selector.js index d403296..cd5f8d2 100644 --- a/posnext/public/js/pos_item_selector.js +++ b/posnext/public/js/pos_item_selector.js @@ -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 } @@ -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; @@ -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(); } });