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

How Vehicle Validation and Auto-Behavior Works

Source: `vehicle.rb`

  • Vehicle records require company_id and body_type at minimum; plate number max length is 15, make and model max 40, VIN max 20 characters
  • Build date accepts mm/yyyy or yyyy format; when set, it auto-populates the year field from the build date
  • Plate number, VIN, and engine number are automatically uppercased on save
  • Acquisition value and sale price have bidirectional tax calculation: entering one auto-calculates the other (inclusive/exclusive) based on the company's tax settings
  • Service interval defaults to the company-level setting; if no company setting exists, it defaults to 6 months
  • Stock number is auto-assigned using a database lock when the vehicle is set to for-sale status, preventing duplicate stock numbers across concurrent operations

Support scenarios

  • "The VIN I entered got changed" → VINs are automatically uppercased on save. This is normal behaviour. If the VIN appears incorrect, check if the original had lowercase characters.
  • "The build date format isn't working" → Build date must be entered as mm/yyyy (e.g., 03/2020) or just yyyy (e.g., 2020). Other formats are not accepted.
  • "I entered the sale price but the ex-tax amount is wrong" → Sale price and acquisition value auto-calculate tax counterparts bidirectionally. Verify the company's tax rate is correct, as the calculation uses that rate.
  • "The stock number was assigned automatically" → Stock numbers are auto-assigned using a database-level lock when a vehicle is set to for-sale. This prevents duplicates in concurrent operations.