How MYOB Admin and Diagnostics Tools Work
Source: myob_admin_controller.rb
- The admin type list maps shortcodes to entity types: c=customer, v=vendor, and additional codes for other entity types — these are used in URL parameters for admin operations
- Single upload to MYOB is only permitted if the record's myob_id field is blank; records that already have a myob_id are rejected to prevent duplicates
- Diagnostics invoice lookup tries the MYOB invoice ID first, then falls back to searching by invoice_number if the ID doesn't match
- Discount handling has two paths: percentage discounts use the DiscountPercent field, while dollar-amount discounts create a separate negative line item on the invoice
- Invoice rounding adjustments create a separate line item using a special rounding product, rather than adjusting an existing line
- "Check duplicate item code" automatically links a product to MYOB if an unlinked product's item code matches (first 30 characters compared)
- "Remove sync duplicate customers" only destroys duplicate records if they have no vehicles, invoices, or events — records with any history are preserved
- "Fix duplicate products" only links ACTIVE products — inactive or discontinued products are ignored
Support scenarios
- "I can't upload a single invoice to MYOB — it says it already exists" → The record already has a myob_id, meaning it was previously synced. If the MYOB-side record was deleted, use diagnostics to clear the myob_id first, then retry the single upload.
- "Duplicate customers appeared after MYOB sync" → Use "Remove sync duplicate customers" from admin tools. Note that duplicates with vehicles, invoices, or events will NOT be auto-removed — those need manual merging.
- "Product didn't link to MYOB automatically" → Auto-linking only checks the first 30 characters of the item code and only matches ACTIVE products. Verify the item code matches within 30 chars and the product is active.