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

How Invoice Number Assignment Works During Processing

Source: invoice.rb:334-353

  • Invoice number assignment follows a priority chain: (1) dealership credit/invoice numbers for vehicle sale or trade-in items, (2) internal invoice number counter for internal type, (3) credit number counter for credit type, (4) if invoice_number_equals_job_number is enabled AND the job number is less than the invoice counter, use the next job card number; otherwise use the job card number, (5) standard company invoice number counter
  • Post date defaults to today (adjusted for company timezone via UTC offset) if not set when processing
  • The system uses Company.use_invoice_number / use_credit_number / use_internal_number which atomically increment the counter
  • Vehicle sales and trade-ins get separate dealership number sequences
  • BUG RISK: if invoice_number_equals_job_number is true and job card numbers get out of sync with invoice numbers, the wrong counter may be used

Support scenarios

  • "The invoice number skipped some numbers" -> another invoice type (credit, internal, dealership) used the same counter, or a concurrent user incremented it
  • "The post date shows yesterday" -> timezone offset caused the date to roll back; the company's UTC offset setting may be wrong
  • "My vehicle sale invoice got a different number format" -> dealership invoices use a separate number sequence from regular invoices