How MYOB Invoice Upload and Sync Works
Source: myob_controller.rb
- Upload order is strictly sequenced: vendors first, then invoices, then credits, then customers, then payments — this ensures dependencies (e.g., vendor records needed by invoices) exist before they are referenced
- Customer payment uploads are skipped if the related invoice has a pending order-to-invoice sync, to avoid uploading a payment against an invoice that hasn't been created in MYOB yet
- Dealership trade-in and vehicle sale link logs are only processed for companies that have the dealership feature enabled
- Voiding an invoice that has trade-in links requires all associated accounting_transaction_link_logs to be deleted first — this is a complex multi-step cleanup process
- Upload errors containing "freighthasnotbeenset" automatically have a help link appended to the error message to guide users to the fix
- Dispersal upload errors are silently rescued (swallowed) — the error is not shown to the user and the sync continues
- MYOB sync is queued as a delayed job set to execute 3 minutes from the current time
Support scenarios
- "Customer payment didn't upload to MYOB" → Check if the related invoice has a pending order-to-invoice sync. Payment upload is skipped until the invoice sync completes. Wait for the invoice to sync first, then the payment will go through on the next run.
- "I'm getting a freight error when uploading to MYOB" → The "freighthasnotbeenset" error means freight accounts aren't configured in accounting settings. Follow the help link appended to the error message, or check the MYOB freight account mapping in settings.
- "Voiding an invoice with a trade-in is failing" → The system needs to delete all accounting_transaction_link_logs for that invoice before it can void. This is a multi-step process — if it's stuck, check whether link logs still exist for the invoice.