Instructions for agents working on this brick
The ar (invoicing) brick, built from modules/ar/module.yaml version 3 (erp-method-l2c). Read erp-platform's BRICKS.md first.
Scaffolded by erp-compose scaffold, then written by hand; the spec is the source of truth, this file only says where things go.
| You are changing… | It goes in |
|---|---|
| a business rule | domain/ (invoice, credit_note, writeoff, schedule, customer, migration_run) and a test in tests/test_rules.py |
| who may do something / which rows | application/use_cases.py (permission=) and application/services.py (visible_*, sees_drafts) |
| how another brick is reached | infrastructure/seams.py only (tax, payments, gl, bp, sales-order, product, migration maps) |
| "today" | infrastructure/clock.py (one port; reads business_timezone) |
| a column or table | infrastructure/tables.py, then python scripts/gen_schema.py, and a NEW migrations/NNNNN_*/ (append only) |
| the Odoo slice | domain/odoo.py (mapping), domain/reconcile.py (checks), infrastructure/odoo.py (reader), load_from_odoo & co |
Rules that must not be undone: an issued invoice is never edited (credit it); settlement is never stored (payments derives it);
tax is the tax module's answer, frozen at issue; no dated row (setting, control, billing profile, account map) takes effect today
or earlier except the first of its key; issue/credit/write-off dates are today in the business time zone; numbers are claimed with
a plain INSERT into ar_number_claims and retried; migrated history is never recomputed, re-posted, re-sent or re-raised.
pytest -q --tb=short && ruff check src tests scripts
python scripts/gen_schema.py --check
BUCKET=l2carlab python scripts/live_check.py # one live check (schema applied by the script; tax is a stand-in)