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

How Serial Number Deletion and Invoice Linking Works

Source: product_serial_numbers_controller.rb:43-154

  • Deleting a serial number from the product list: if it has a vendor_invoice_id or invoice_id, it is soft-voided (voided = true); otherwise it is hard-deleted permanently
  • Attaching serial numbers to an invoice item sets both invoice_id and invoice_item_id on each serial number
  • Removing serial numbers from an invoice clears both invoice_id and invoice_item_id back to nil -- the serial number itself is preserved
  • Deleting a vendor invoice item hard-deletes ALL serial numbers linked to it (destroy_all) -- this is destructive and data is lost
  • Deleting a customer invoice item clears invoice_id and invoice_item_id on linked serial numbers but does NOT destroy them -- the serial numbers survive and become available for reassignment

Support scenarios

  • "Why can't I permanently delete this serial number?" → It is linked to a vendor invoice or customer invoice, so it can only be voided
  • "Do serial numbers get deleted when I remove an invoice item?" → No, they are unlinked but preserved; only vendor invoice item deletion destroys serial numbers
  • "I deleted a vendor invoice item and my serial numbers are gone" → Vendor invoice item deletion hard-deletes all associated serial numbers; this is not recoverable through the UI
  • "Serial number shows as available again after removing from invoice" → Removing from an invoice clears the link, making it available for re-assignment