How Deposits on Invoices Work
Source: customer_deposit.rb:52-57, invoices_controller.rb:2764, invoices_controller.rb:2885-2892
- New deposits default to "open" status if no status is provided
- Adding or removing a deposit triggers an invoice recalculation (set_sum_of_items) because the deposit's after_save and after_destroy callbacks save the parent invoice
- Deposits reduce the balance_due on open invoices (balance_due = total - deposits_total)
- Deposits are not allowed on credit or internal invoice types -- error: "Remove deposits before continuing"
- On invoice processing, each customer_deposit is automatically converted to a CustomerPayment, processed, and the deposit status is set to closed
- After conversion, the deposit amount becomes a proper payment record in the system
Support scenarios
- "Why can't I add a deposit to a credit note?" -> deposits are only allowed on standard invoices, not credits or internal invoices
- "The balance due changed when I added a deposit" -> deposits reduce balance_due on open invoices; this is expected
- "Where did the deposit go after processing?" -> it was converted to a customer payment; check the payments section for the invoice