mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-18 02:20:37 -05:00
Fill the VIN on new estimates and invoices through a hook
New hook qbo_billing_default_vin, { customer:, issues: }: a blank estimate or invoice starts with the VIN
a plugin gives for the customer, and an invoice made from an estimate without a VIN gets the one for the
estimate's work orders. The editor only filled the VIN when the customer was changed or work orders were
imported, so pages opened with the customer already set started blank.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
4 files changed
+21
-1
No files matched your search
@@ -47,6 +47,7 @@ module RedmineQboBilling
|
||||
customer_name: customer&.name,
|
||||
email: writer.customer_email(customer),
|
||||
billing_address: writer.customer_address(customer),
|
||||
vin: RedmineQboBilling.default_vin(customer),
|
||||
txn_date: user.today.iso8601,
|
||||
sales_person: user.name,
|
||||
customer_memo: Company.invoice_message,
|
||||
@@ -70,7 +71,10 @@ module RedmineQboBilling
|
||||
form.customer_id = source.customer_id
|
||||
form.email = source.email.presence || form.email
|
||||
form.billing_address = source.billing_address.presence || form.billing_address
|
||||
form.vin = source.vin
|
||||
# The estimate's VIN, or else a plugin's for the estimate's work orders (e.g. their vehicle)
|
||||
form.vin = source.vin.presence ||
|
||||
RedmineQboBilling.default_vin(customer, issues: Issue.where(estimate_id: source.id.to_s).to_a) ||
|
||||
form.vin
|
||||
form.mileage = source.mileage
|
||||
# The estimate's writer sells the job; with no one on the estimate, whoever writes the invoice
|
||||
form.sales_person = source.sales_person.presence || user.name
|
||||
|
||||
Reference in new issue
Block a user