How Product Inactivation Rules Work
Source: products_controller.rb:218-221, products_controller.rb:595-604, product.rb:7
- A product cannot be made inactive if it is used in any active bundle (BOM) -- the system checks all BomItems referencing the product
- A product cannot be made inactive if it is referenced by a default company setting (e.g., default labour product, default vehicle sale product)
- Product type cannot be changed to labor if quantity_on_hand is non-zero -- you must zero out stock first
- Inactive products are hidden from all standard queries by the default scope, just like deleted products
- Reactivation uses an unscoped query to locate the hidden product and set inactive back to false
Support scenarios
- "Why can't I make this product inactive?" → It is used in an active bundle or referenced by a default company setting
- "Why can't I change my product type to Labour?" → The product still has stock on hand; set quantity to zero first
- "Product disappeared after I made it inactive" → The default scope hides inactive products from normal searches; use the reactivate function to bring it back