How Branch Product Deletion Cascading Works
Source: products_controller.rb:244, products_controller.rb:252
- When a head office branch owner deletes a branch product, all linked copies at franchise stores are also deleted or soft-deleted
- The cascade only triggers when all three conditions are met: the product has is_branch_product = true, the company is on dealer_multibranch_version, and the user is the branch_owner
- Non-branch-owner deletions do not cascade -- only the local copy is affected
- The cascading deletion follows the same three-tier logic as regular deletion (blocked if active references, soft-delete if historical, hard-delete if clean)
Support scenarios
- "Why did a product disappear from my store when head office deleted theirs?" → Branch product deletion cascades from head office to all linked franchise stores
- "I deleted a product at my store but it's still at other branches" → Only branch owners trigger cascading deletions; non-owner deletions are local only
- "Product was deleted at head office but still shows in my reports" → The cascade may have soft-deleted (not permanently removed) the product due to historical references