How Stock Take Filtering and Setup Works
Source: stock_takes_controller.rb:4-56
- Stock take validates product type against system-defined ProductType codes (uppercased); invalid types raise an error
- Deleted and inactive products are excluded from the stocktake automatically
- Location filter uses exact match unless the wildcard "*" is used, which shows all locations
- Filtering by product group is supported: the group name is URL-decoded and validated before applying
- Filtering by vendor is supported: the vendor is validated to exist before applying
- Zero-quantity products can be hidden with the hide_zeros parameter (set to "true")
- Begin/end item range must be in alphabetical order -- if the begin item code is alphabetically after the end code, an error is raised
- Sort fields are whitelisted to: item_code, description, company_name, product_group_name, location, quantity_on_hand; any other sort field defaults to item_code
- Null handling on sort: blank vendor/location/group values sort to the end (NULLS LAST for ASC) or beginning (NULLS FIRST for DESC)
Support scenarios
- "Why am I getting 'Invalid product type' on stocktake?" → The product type code is not in the system's defined list; check for typos
- "Why don't I see inactive products in the stocktake?" → Inactive and deleted products are automatically excluded from stocktakes
- "Why am I getting 'begin item and end item is not in alphabetical order'?" → The begin item code must come before the end item code alphabetically
- "Why does my stocktake always sort by item code?" → The requested sort field is not in the allowed whitelist, so it defaults to item_code