feat: operational resource procurement facility

Implement RESOURCE-WP-0005: entity register, V0.1 terms parameters,
entity association on inventory and planning records, transfer-price
and credit-state arithmetic, monthly settlement, and entity views on
the portfolio report. Live close emits nothing until delivered cost
is known. Handoffs are FIN-WP-0006 and RAILIANCE-WP-0017.
This commit is contained in:
tegwick 2026-08-14 13:15:02 +02:00
parent 325a505980
commit f8d1c542d5
37 changed files with 1316 additions and 28 deletions

View file

@ -9,6 +9,8 @@ import sys
from datetime import date
from pathlib import Path
from entities import association_ok
RESOURCE_ID = re.compile(r"^resource:[a-z0-9][a-z0-9:_-]+$")
STATUSES = {
"proposed", "ordered", "commissioning", "active", "suspended",
@ -47,6 +49,8 @@ def validate_record(record: dict) -> None:
if record.get("record_scope") not in {"inventory", "example"}:
raise ValueError("record_scope must be inventory or example")
association_ok(record)
allocation = record["ownership"]["allocation"]
if allocation["mode"] == "unattributed":
if allocation["cost_attribution_key"] is not None: