Handle QuickBooks custom fields generically; no vehicle code left

redmine_qbo now works the same for any business; vehicle behaviour lives in redmine_qbo_vehicles.

- Every enabled QuickBooks text custom field gets a box on the estimate/invoice editor (the sales person
  is still filled in automatically). Forms keep custom_fields { field_id => value } instead of vin and
  mileage; Duplicate and Create invoice copy them all.
- Company: custom_field_matching(pattern) and editable_custom_fields; the VIN and Mileage name patterns
  are gone.
- Hooks are keyed by custom field id: qbo_billing_field_options (box suggestions) and
  qbo_billing_field_defaults (values for a document's work orders) replace the VIN hooks;
  qbo_billing_issue_values returns { field_id => { issue_id => value } }.
- Editor script API for plugins: window.qboEditor, the qbo:customer-changed and qbo:imported events, and
  the view_qbo_estimate_form_bottom hook to add a script. The VIN/mileage filling and the several-vehicle
  warning moved to redmine_qbo_vehicles.
- EstimateWriter.create_estimate(custom_fields:), custom_field_value and custom_field_values replace
  the vin/mileage arguments and vin_for.

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 11:34:10 -04:00
1 parent cb705d9525
commit 388ac915d7
14 files changed
+192 -164

No files matched your search

+4 -3
View File
@@ -106,8 +106,8 @@ class QboEstimatesController < ApplicationController
end
end
# Customer details for the editor when a customer is picked: email, billing address and the VINs plugins
# suggest for the VIN box (RedmineQboBilling.vin_options)
# Customer details for the editor when a customer is picked: email, billing address and the suggestions
# plugins give for the custom field boxes (RedmineQboBilling.field_options)
def customer_info
customer = Customer.find_by(id: params[:customer_id])
return render(json: {}, status: :not_found) unless customer
@@ -117,7 +117,7 @@ class QboEstimatesController < ApplicationController
name: customer.name,
email: RedmineQboBilling::EstimateWriter.customer_email(customer),
billing_address: RedmineQboBilling::EstimateWriter.customer_address(customer),
vin_options: RedmineQboBilling.vin_options(customer)
field_options: RedmineQboBilling.field_options(customer)
}
end
@@ -205,6 +205,7 @@ class QboEstimatesController < ApplicationController
params.require(:estimate).permit(
:sync_token, :total_tax, :discount, :email_status, :txn_status,
*RedmineQboBilling::EstimateForm::HEADER_ATTRIBUTES,
custom_fields: {},
lines: RedmineQboBilling::EstimateForm::Line::PARAMS
)
end