Adds _delete_unused_accounts hook that hard-deletes (not archives) every account that's safe to remove — not owned by nexa_coa_setup AND not referenced by: - account.move.line postings - account.tax.repartition.line - account.journal default/suspense/profit/loss accounts - account.fiscal.position.account substitution maps - product.category and product.template JSONB property_account_* fields - res.partner JSONB property_account_payable_id/receivable_id - res.company exchange/transfer/POS receivable accounts Tries bulk unlink first; falls back to per-record if a batch fails so the rest still get cleaned. Result on staging: 554 -> 172 total accounts (deleted 382). The 31 still archived are blocked by references (historical postings, tax repartition links, bank journal defaults, etc.) — left as archived so they're hidden from dropdowns but preserve audit history. Verified all 4 test invoices still post correctly (ON 113, US 100, QC 114.98, Westin intercompany 169.50). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
22 KiB
22 KiB