aeat.application.modelo._calculation_preparation module¶
Preparation gates for modelo calculation actions.
This module prepares calculation input channels against the registry
ModeloRevision for a WorkUnit, resolves the law-determined
RegistrySnapshot, applies the Modelo 303 IVA wallet gate, and runs
ledger preflight through a TransactionCatalogueRepository before
calculation proceeds.
See also
calculate_modelo_revision():Consumes the prepared bundle before persisting a draft revision.
resolve_calculation_binding_channels():Merges caller, backend, borrador, enum, and date binding channels.
_iva_wallet_gate:Applies the persisted Modelo 303 IVA-wallet authority during preparation.
- class PreparedCalculation(work_units, work_unit, snapshot, casilla_inputs, backend_casilla_inputs, period_date, channels)[source]¶
Bases:
objectValidated calculation preflight bundle consumed by the action layer.
work_unitis the loadedWorkUnit;snapshotis the resolvedRegistrySnapshot;channelsis the mergedResolvedCalculationChannelsset that the registry engine will consume. Casilla inputs have already been canonicalised and ledger, profile, required-binding, borrador, and IVA-wallet gates have already run.- Parameters:
work_units (WorkUnitCatalogue)
work_unit (WorkUnit)
snapshot (RegistrySnapshot)
period_date (date)
channels (ResolvedCalculationChannels)
-
work_units:
WorkUnitCatalogue¶
-
snapshot:
RegistrySnapshot¶
-
channels:
ResolvedCalculationChannels¶
- prepare_calculation(*, work_unit_id, work_unit_repository, casilla_inputs, backend_casilla_inputs, ledger_preflight_transaction_repository, iva_compensation_decision, iva_compensation_decision_repository, binding_values, enum_binding_values, backend_binding_values, filing_period_date, borrador_snapshot_id, borrador_snapshot_repository, unresolved_relation_ids, unresolved_binding_ids)[source]¶
Prepare validated inputs, source channels, and gates for calculation.
The resolved registry
ModeloRevisionsupplies binding and casilla requirements.ledger_preflight_transaction_repositorymay provide aTransactionCatalogueRepositoryfor the ledger-tax readiness check.iva_compensation_decision_repositorymay provide the matchingIvaWalletDecisionRepositoryfor the Modelo 303 wallet authority, whileBorrador100SnapshotRepositorysupplies the optional Modelo 100 borrador tier.- Return type:
- Returns:
A
PreparedCalculationcarrying theWorkUnit,RegistrySnapshot, validated inputs, period date, andResolvedCalculationChannels.- Parameters:
work_unit_id (str)
work_unit_repository (WorkUnitCatalogueRepositoryProtocol)
ledger_preflight_transaction_repository (TransactionCatalogueRepository | None)
iva_compensation_decision (object | None)
iva_compensation_decision_repository (IvaWalletDecisionRepository | None)
filing_period_date (date | None)
borrador_snapshot_id (str | None)
borrador_snapshot_repository (Borrador100SnapshotRepository | None)
unresolved_relation_ids (tuple[RelationId, ...])
unresolved_binding_ids (tuple[BindingId, ...])