Blank VIN on new documents; VIN from attached estimates; read estimate VINs with newer custom fields

- New estimates and invoices start with a blank VIN; picking a customer only fills the VIN box's
  suggestions.
- Importing an estimate whose work orders give no VIN fills the invoice's VIN box with the estimate's
  own VIN (open estimates now carry it).
- EstimateWriter.vin_for reads an estimate's VIN with QuickBooks' newer custom fields (cached a minute).
  The local Estimate's details leave those out, so plugins matching the estimate's VIN to a vehicle
  never found one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-31 10:52:39 -04:00
1 parent abeb0fe0f5
commit cb705d9525
5 files changed
+40 -20

No files matched your search

+4 -3
View File
@@ -43,10 +43,11 @@ module RedmineQboBilling
[]
end
# The VIN a new estimate or invoice starts with, from plugins answering
# The VIN for a document's work orders, from plugins answering
# :qbo_billing_default_vin, { customer:, issues: } => a VIN or nil (e.g. redmine_qbo_vehicles: the work
# orders' vehicle when they share one, else the customer's only vehicle)
# issues are the work orders behind the document (e.g. the issues linked to the estimate it's made from).
# orders' vehicle when they share one)
# Used for an invoice made from an estimate that has no VIN (issues: the estimate's work orders). New
# estimates and invoices start with a blank VIN.
def self.default_vin(customer, issues: [])
return nil unless customer