dodil/erp-brick-ar

DODIL ERP brick: accounts receivable

AGENTS.md

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 ruledomain/ (invoice, credit_note, writeoff, schedule, customer, migration_run) and a test in tests/test_rules.py
who may do something / which rowsapplication/use_cases.py (permission=) and application/services.py (visible_*, sees_drafts)
how another brick is reachedinfrastructure/seams.py only (tax, payments, gl, bp, sales-order, product, migration maps)
"today"infrastructure/clock.py (one port; reads business_timezone)
a column or tableinfrastructure/tables.py, then python scripts/gen_schema.py, and a NEW migrations/NNNNN_*/ (append only)
the Odoo slicedomain/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)