How Stock Transfers Between Branches Work
Source: products_controller.rb:607-633
- Three validations: sender and receiver must share the same branch_id, the requesting company must be in the same branch, and sender cannot equal receiver (no self-transfers)
- If the receiving branch does not have a product with the same item_code, a new product is automatically created copying all fields from the sender's product
- Transfer quantity is validated against available stock (quantity_on_hand minus qty_reserved) -- you cannot transfer reserved stock
- Each transfer creates two stock transfer log entries: a "transferred_from" log for the sender and a "transferred_to" log for the receiver
- Both transfer logs are flagged for Xero/MYOB/QBO sync to keep accounting systems in sync
Support scenarios
- "Why can't I transfer stock to another branch?" → The branches may not share the same branch_id, or you may be trying to transfer to your own company
- "Why was a new product created at the receiving branch during stock transfer?" → The receiving branch did not have a product with the same item_code, so one was created automatically
- "Why can't I transfer all my stock when some is reserved?" → Transfer quantity cannot exceed available stock (on hand minus reserved)
- "Why do I see two log entries for one stock transfer?" → One log is for the sending side ("transferred_from") and one for the receiving side ("transferred_to")