How Stock Take Search and Barcode Scanning Works
Source: stock_takes_controller.rb:201-204, stock_takes_controller.rb:68, stock_take_logs_controller.rb:6-10
- Single item search (barcode scan) excludes BOM parent products and price lookup products
- The search first tries an exact match excluding BOM parents; if no exact match, it does a broader search also excluding price_lookup items
- If the search returns more than one product, it raises "More than one product matches" -- the barcode or item code is not unique enough
- The count_excludes_reserved flag is parsed from multiple truthy representations ('t', 'true', true) after downcasing
- Stock take logs support pagination; if page_size and offset are not valid integers, all logs are returned; logs are always ordered by post_date descending (newest first)
- Stock transfer logs are also ordered by created_on descending for consistent newest-first display
Support scenarios
- "Why can't I find my bundle product in the stocktake search?" → BOM parent products are excluded from stocktake search because their stock is tracked via child items
- "Why am I getting 'more than one product matches' when scanning a barcode?" → Multiple products share the same item code or barcode; make them unique
- "What does 'count excludes reserved' mean in stocktake?" → When enabled, your physical count is treated as available stock only, and reserved quantities are added back on top
- "How do I see all stocktake history for a product?" → Check the stock take logs, which are paginated and sorted by date (newest first)