From e36077f4507f682df68a7e1b6662cbc0c38f4763 Mon Sep 17 00:00:00 2001 From: Ahmad Khanalizadeh Date: Tue, 15 Nov 2022 10:29:52 +0000 Subject: [PATCH] [FIX] point_of_sale: search all fields when loading from database Before this commit: when `Limited Products Loading` is enabled in PoS settings, and `Load all remaining products in the background` is disabled, the search bar only uses `name` to look for products to fetch from database. This causes problem when for example the user is using barcodes to identify products. To fix this, the search domain should be expanded to include all of the fields which are normally used when searching for products. opw-3055960 closes odoo/odoo#105829 X-original-commit: ac6a7c7c34c0e4d4b4d7c7dcfb2d939a70a5bf09 Signed-off-by: Masereel Pierre --- .../js/Screens/ProductScreen/ProductsWidgetControlPanel.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductsWidgetControlPanel.js b/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductsWidgetControlPanel.js index 6dd5293dd81..41d4f813312 100644 --- a/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductsWidgetControlPanel.js +++ b/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductsWidgetControlPanel.js @@ -66,7 +66,10 @@ odoo.define('point_of_sale.ProductsWidgetControlPanel', function(require) { let ProductIds = await this.rpc({ model: 'product.product', method: 'search', - args: [['&', ['name', 'ilike', this.state.searchInput + "%"], ['available_in_pos', '=', true]]], + args: [['&',['available_in_pos', '=', true], '|','|','|', + ['name', 'ilike', this.state.searchInput], + ['default_code', 'ilike', this.state.searchInput], + ['barcode', 'ilike', this.state.searchInput]]], context: this.env.session.user_context, }); if(ProductIds.length) {