How Item Code Uniqueness and Product Search Works
Source: products_controller.rb:331-333, products_controller.rb:381-447, products_controller.rb:465-478
- Item code uniqueness is checked case-insensitively using ILIKE -- "OIL01" and "oil01" are considered duplicates
- The product list search excludes deleted, inactive, and price_lookup products by default
- Search matches against item_code, description, brand, and searchable_tags fields
- The labor product search includes bundles that contain labor-type BOM items (product_type = 'J'), even if the bundle itself is not a labor product
- In multibranch environments, the product list includes head office products not yet copied locally, using a NOT EXISTS subquery
- Product locations list includes an "All" option with code "*" appended to the distinct non-blank locations
Support scenarios
- "Why can't I create a product with the same item code in different case?" → Item codes are case-insensitive; "FILTER01" and "filter01" are treated as the same code
- "Why isn't my product showing up in the product search?" → It may be inactive, deleted, or flagged as a price_lookup product
- "Why is a non-labor product showing up in my labor product search?" → The product is a bundle that contains labor-type items inside it
- "I see products from head office I didn't create" → In multibranch mode, head office products appear in the local list until they are copied or excluded