Skip to content
English
  • There are no suggestions because the search field is empty.

How Invoice Deletion Rules Work

Source: invoices_controller.rb:266-293

  • Cannot delete an invoice that has customer deposits attached -- error: "To delete this job card you first need to remove the attached deposit"
  • Cannot delete closed invoices, Xero-synced invoices (xero_id is not blank), or invoices with serial numbers attached
  • If the invoice was part of a split, the split flags and IDs are cleaned up on both source and target invoices
  • If a loan car was assigned to the invoice, its invoice_id is cleared on deletion
  • When WS API integration is active, invoices are soft-deleted (deleted=true) instead of hard-deleted; this preserves data for API consumers
  • Only open invoices can be deleted; processed/closed invoices must be voided instead

Support scenarios

  • "Why can't I delete this job card?" -> check for attached deposits, Xero sync, serial numbers, or non-open status
  • "I deleted one half of a split invoice -- what happens to the other?" -> the split relationship is cleaned up and the remaining invoice becomes standalone
  • "The invoice is still in the database after I deleted it" -> WS API integration is active so it was soft-deleted; it won't appear in the UI but exists in the database