aeat.domain.filing._amendment module¶
Strict amendment domain records for domain.filing.
Houses the immutable records that describe an AEAT amendment. The
amended_draft field on each amendment record holds the originating
ModeloDraft that the amendment modifies, keeping the draft’s
casilla arithmetic and tax due values bound to the amendment for
audit purposes.
Concrete variants are ModeloComplementaria (LGT Art. 122.2)
and ModeloSustitutiva (LGT Art. 122.1), the
CasillaChange delta entries, and the AmendmentKind
enum. The orchestration use case
application.filing.build_complementaria() lives at
application.filing._complementaria; this module contains
only the typed shapes and the deterministic
make_amendment_id() helper so the repository (also under
domain.filing) can persist amendments without depending
on the application layer.
Callers operate on the discriminated union ModeloComplementaria |
ModeloSustitutiva. There is no umbrella alias - pick the variant
that matches the LGT Art. 122 article you’re filing under.
- class AmendmentKind(*values)[source]¶
Bases:
StrEnumLegally distinct amendment kinds supported by the engine.
- COMPLEMENTARIA¶
- SUSTITUTIVA¶
- class CasillaChange(**data)[source]¶
Bases:
BaseModelOne changed casilla in an amendment delta.
- casilla_id: CasillaId¶
- old_value: Decimal | None¶
- new_value: Decimal¶
- reason: str¶
- class BaseAmendment(**data)[source]¶
Bases:
BaseModelShared shape across the two LGT Art. 122 amendment variants.
Concrete subclasses fix the
amendment_kinddiscriminator to a singleAmendmentKindliteral so callers select the variant by class, not by enum value.- Parameters:
amendment_id (str)
submission_id (str)
original_csv (str)
original_model (ModeloCode)
original_period (Period)
delta (CasillaDelta)
amended_draft (ModeloDraft)
created_at (datetime)
- amendment_id: str¶
- submission_id: str¶
- original_csv: str¶
- original_model: ModeloCode¶
- original_period: Period¶
- delta: CasillaDelta¶
- amended_draft: ModeloDraft¶
- created_at: datetime¶
- class ModeloComplementaria(**data)[source]¶
Bases:
BaseAmendmentLGT Art. 122.2 complementaria: corrects an already-presented filing.
- Parameters:
original_model (Annotated[ModeloCode, MinLen(min_length=1)])
original_period (Period)
delta (Annotated[CasillaDelta, MinLen(min_length=1)])
amended_draft (ModeloDraft)
created_at (datetime)
amendment_kind (Literal[AmendmentKind.COMPLEMENTARIA])
- amendment_kind: Literal[AmendmentKind.COMPLEMENTARIA]¶
- class ModeloSustitutiva(**data)[source]¶
Bases:
BaseAmendmentLGT Art. 122.1 sustitutiva: replaces an already-presented filing in full.
- Parameters:
original_model (Annotated[ModeloCode, MinLen(min_length=1)])
original_period (Period)
delta (Annotated[CasillaDelta, MinLen(min_length=1)])
amended_draft (ModeloDraft)
created_at (datetime)
amendment_kind (Literal[AmendmentKind.SUSTITUTIVA])
- amendment_kind: Literal[AmendmentKind.SUSTITUTIVA]¶
- make_amendment_id(*, submission_id, amendment_kind, delta)[source]¶
Compute a stable amendment identifier.
- Return type:
- Parameters:
submission_id (str)
amendment_kind (AmendmentKind)
delta (CasillaDelta)