dodil/erp-brick-consolidation
DODIL ERP brick: consolidation
src/brick_consolidation/domain/statement.py
"""The Statement aggregate — the rules, and nothing else.
a materialised group statement of a signed period
No database, no HTTP, no identity: a rule here is true whoever calls it and however it is stored.
Generated by `erp-compose scaffold` from module.yaml; the TODO lines are the work left.
"""
from dataclasses import dataclass, field
from datetime import datetime
from decimal import Decimal
from typing import Optional
@dataclass
class Statement:
"""a materialised group statement of a signed period"""
report: str
group_id: str
period_id: str
node_id: str
amount: Decimal = Decimal("0.00")
prior_year: str = ""
produced_at: Optional[datetime] = None
digest: str = ""
events: list = field(default_factory=list, repr=False, compare=False)
def _record(self, event):
self.events.append(event)
return event