feat(nexa_coa_setup): convert chart of accounts to 4-digit codes

Renumbered all 128 Nexa accounts from 6-digit (l10n_ca style) to clean
4-digit codes for readability:

  1000-1999  Assets
    1120  Due From Shareholder
    1210  HST/GST ITC Receivable
    1510-1750  Capital assets + accumulated depreciation
  2000-2999  Liabilities
    2110  HST/GST Collected
    2510  Due To Shareholder
  3000-3999  Equity
    3010  Common Shares
    3510  Retained Earnings — Current
  4000-4999  Revenue
    4010-4050  Recurring (SaaS, Hosting, Support, ...)
    4110-4160  Project work
    4210-4230  Hourly services
    4310-4320  Reseller
  5000-5999  COGS
    5010-5120  Infrastructure & APIs
    5210-5250  Project direct costs
    5310-5320  Resold goods
  6000-6999  Operating expenses
    6010-6092  Personnel (T4)
    6110-6120  Contract labour
    6210-6960  Office/Tech/Marketing/Professional/Insurance/Travel/Training/Banking
  7000+  Other (bad debt, donations, FX, depreciation)

Applied to prod via scripts/convert_to_4digit.py (now committed). XML
codes updated in 01_account_account.xml; XMLIDs preserved so existing
ir.model.data rows on prod stay valid.

Hook constants updated:
- _TAX_REPARTITION_REMAP targets: 118100 -> 1210, 213100 -> 2110, etc.
- _LEGACY_RENAMES new_name strings: 're-class to NNNN' guidance updated
  to 4-digit targets.

Verified -u on prod completes cleanly + all 4 test invoices still post:
  ON     -> 4010 SaaS, total 113.00
  US     -> 4010 SaaS, total 100.00 (zero-rated)
  QC     -> 4010 SaaS, total 114.98
  Westin -> 4210 Consulting, total 169.50

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-12 20:09:01 -04:00
parent 749c0335fa
commit 86e89ca419
3 changed files with 317 additions and 146 deletions

View File

@@ -232,18 +232,18 @@ def _delete_unused_accounts(env):
# at the new accounts, so when an invoice creates tax journal items they hit
# 118100 (ITC) and 213100 (HST collected) instead of the archived legacy ones.
_TAX_REPARTITION_REMAP = {
# ITC / receivable side
"118100.OLD": "118100",
"118200.OLD": "118300", # PST/QST receivable → QST refund receivable
"118300.OLD": "118100",
"118400": "118100", # 14% HST receivable
"118500": "118100", # 15% HST receivable
# Payable / collected side
"231000": "213100", # GST to pay
"232000": "213500", # PST/QST to pay
"233000": "213100", # HST 13% to pay
"234000": "213100", # HST 14% to pay
"235000": "213100", # HST 15% to pay
# ITC / receivable side → Nexa 1210 HST/GST ITC Receivable (or 1230 QST refund)
"118100.OLD": "1210",
"118200.OLD": "1230",
"118300.OLD": "1210",
"118400": "1210",
"118500": "1210",
# Payable / collected side → Nexa 2110 HST/GST Collected (or 2120 QST collected)
"231000": "2110",
"232000": "2120",
"233000": "2110",
"234000": "2110",
"235000": "2110",
}
@@ -483,20 +483,20 @@ def _archive_unused_l10n_ca_accounts(env):
# accountant-driven reconciliation.
_LEGACY_RENAMES = [
# (code, new_name, archive_after)
("1400", "(LEGACY) Transferred to Gurpreet — re-class to 221100", True),
("1505", "(LEGACY) Sent to India — re-class to 612200", True),
("1400", "(LEGACY) Transferred to Gurpreet — re-class to 2510", True),
("1505", "(LEGACY) Sent to India — re-class to 6120", True),
("1580", "(LEGACY) Transferred to Westin — Westin is now a partner", True),
("1590", "(LEGACY) Transferred to Divine — Divine is now a partner", True),
("1600", "(LEGACY) Transferred to Manpreet — non-related; archive", True),
("1500", "(LEGACY) Food & Entertainment — re-class to 671200", True),
("1501", "(LEGACY) Office Expenses — re-class to 621500", True),
("411000", "(LEGACY) Inside Sales — re-class to 412xxx specific lines", True),
("1500", "(LEGACY) Food & Entertainment — re-class to 6720", True),
("1501", "(LEGACY) Office Expenses — re-class to 6250", True),
("411000", "(LEGACY) Inside Sales — re-class to 4xxx specific lines", True),
("412000", "(LEGACY) Harmonized Provinces Sales — handled by tax codes", True),
("413000", "(LEGACY) Non-Harmonized Provinces Sales — handled by tax", True),
("414000", "(LEGACY) International Sales — handled by Zero-rated Export", True),
("12000", "(LEGACY) Abdul & Future Mobility — use partner subledger", True),
("12001", "(LEGACY) MSI Account — use partner subledger", True),
("110010", "(LEGACY) Bank Fee — re-class to 691100", True),
("110010", "(LEGACY) Bank Fee — re-class to 6910", True),
]