Match the estimate's VIN with redmine_qbo's enhanced read; no VIN for new documents

- Vehicles::EstimateVehicle.vin uses RedmineQboBilling::EstimateWriter.vin_for, which includes
  QuickBooks' newer custom fields; the local estimate's details don't, so the VIN never matched and
  issues created from an estimate got no vehicle.
- qbo_billing_default_vin only answers for work orders (no customer-vehicle fallback), so new
  estimates and invoices start blank.

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:40 -04:00
1 parent d987746c40
commit 1aa2fa9d5e
3 files changed
+8 -15

No files matched your search

+4 -3
View File
@@ -14,10 +14,11 @@ module Vehicles
module EstimateVehicle
module_function
# The VIN on the estimate, or nil
# The VIN on the estimate, or nil. Read by redmine_qbo with QuickBooks' newer custom fields: the local
# estimate's details leave them out, so a VIN field added recently in QuickBooks would never match.
def vin(estimate)
company = RedmineQboBilling::Company
RedmineQboBilling::EstimateWriter.custom_value(estimate.details, company.vin_field, company::VIN_NAME).to_s.strip.presence
return nil unless estimate
RedmineQboBilling::EstimateWriter.vin_for(estimate.id)
rescue StandardError
nil
end