diff --git a/CLAUDE.md b/CLAUDE.md index 6e456f3b..a37424d1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -232,3 +232,41 @@ catches undefined names instantly. open the systray helpdesk dialog. The Mine/All toggle appears for the owner; "All" shows all 50 ENTECH tickets, "Mine" shows the count matching the owner's profile email. Tracebacks live in `/var/log/odoo/odoo-server.log` on entech (LXC 111 / pve-worker5). + +## Fusion Centralized Billing (`fusion_centralize_billing`) — engine + test harness + +Odoo (`odoo-nexa`, live DB `nexamain`) is being made the single billing brain for every +NexaSystems app (NexaCloud, NexaDesk/Fusion-Chat, NexaMaps), **superseding Lago**. The +module adds only the metering + integration layer (service registry, identity links, +metric/charge catalog, aggregate-push usage engine, inbound Lago-shaped REST API at +`/api/billing/v1/*`, outbound HMAC webhooks, dual-run reconciliation); all financial +behaviour is native Odoo **Enterprise** (`sale_subscription` + `payment_stripe` + +`account_accountant`). Design + rollout live in `docs/superpowers/specs/` +(`2026-05-27-nexa-billing-centralized-design.md` = architecture; +`2026-06-02-nexacloud-odoo-billing-cutover-design.md` = NexaCloud pilot: build → import → +dual-run → gated flip) and `docs/superpowers/plans/`. + +**Testing it — NOT on local `odoo-modsdev` (community) and NEVER `-u` against live `nexamain`.** +It needs Enterprise deps, so tests run on `odoo-nexa` in an **isolated throwaway container** +against a **fresh** DB with the Canadian localization: +``` +ssh odoo-nexa +# fresh DB (inside odoo-nexa-db): dropdb --if-exists fcb_test; createdb fcb_test +cp -a /opt/odoo/custom-addons /opt/odoo/custom-addons-staging # edit/sync HERE, never the live module dir +docker run --rm --network odoo_odoo-network \ + -v /opt/odoo/custom-addons-staging:/mnt/extra-addons:ro -v /opt/odoo/enterprise-addons:/mnt/enterprise-addons:ro \ + -v /opt/odoo/odoo.conf:/etc/odoo/odoo.conf:ro -v /opt/odoo/staging-data:/var/lib/odoo \ + odoo-nexa:19 -c /etc/odoo/odoo.conf -d fcb_test --db_host=db --db_user=odoo \ + --addons-path=/usr/lib/python3/dist-packages/odoo/addons,/mnt/extra-addons,/mnt/enterprise-addons \ + --without-demo=all --test-enable --test-tags /fusion_centralize_billing \ + -i l10n_ca,fusion_centralize_billing --stop-after-init --no-http +``` +Iterate with `-u fusion_centralize_billing` (reuse fcb_test). Gotchas that cost hours: +- **`l10n_ca` is required** — the ledger tests need a Canadian CoA + active CAD + 13% HST. +- A **prod clone is the wrong base** — its existing rows collide with fixed-code test fixtures + (`nexacloud` service / `cpu_seconds` metric) across 5 test files. +- odoo.conf sets `log_level=warn`, so **passing tests log nothing** — exit 0 alone does NOT + prove tests ran (a tag matching zero tests is also exit 0). Confirm execution with + `--log-handler=odoo.addons.fusion_centralize_billing.tests:INFO` (look for `Starting + .`). The **exit code is authoritative** (1 on any failure). +- Do **NOT** pass `--workers=0` (blanks captured stdout) or `--logfile=/dev/stdout` (errors out).