cadrumo.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 the application-facing transaction port 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_units_revision_id, work_unit, snapshot, profile, 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_units_revision_id (str)
work_unit (WorkUnit)
snapshot (RegistrySnapshot)
profile (ModeloWorkProfile)
period_date (date)
channels (ResolvedCalculationChannels)
-
work_units:
WorkUnitCatalogue¶
-
work_units_revision_id:
str¶ The revision
work_unitswas read at. Carried because the persistence this feeds composes that catalogue into a co-commit, which cannot use a self-committing mutation: without the revision its batch rewrites the whole singleton row over a unit another caller created in between.
-
snapshot:
RegistrySnapshot¶
-
profile:
ModeloWorkProfile¶
-
channels:
ResolvedCalculationChannels¶
- prepare_calculation(*, work_unit_id, work_unit_repository, casilla_inputs, backend_casilla_inputs, ledger_preflight_transaction_repository, usage_ratio_profile_loader, operation, iva_compensation_decision, observation_repository, iva_compensation_decision_repository, iva_compensation_history_repository, binding_values, enum_binding_values, backend_binding_values, filing_period_date, borrador_snapshot_id, borrador_snapshot_repository, unresolved_relation_ids, unresolved_binding_ids, profile)[source]¶
Prepare validated inputs, source channels, and gates for calculation.
The resolved registry
ModeloRevisionsupplies binding and casilla requirements.ledger_preflight_transaction_repositorymay provide aTransactionCatalogueRepositoryProtocolfor the ledger-tax readiness check.iva_compensation_decision_repositorymay provide the matchingIvaWalletDecisionRepositoryProtocolfor 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 (TransactionCatalogueRepositoryProtocol)
usage_ratio_profile_loader (UsageRatioProfileLoader)
operation (PinnedAuthorityOperation)
iva_compensation_decision (object | None)
observation_repository (CalculationObservationRepositoryProtocol)
iva_compensation_decision_repository (IvaWalletDecisionRepositoryProtocol)
iva_compensation_history_repository (IvaCompensationHistoryRepositoryProtocol)
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, ...])
profile (ModeloWorkProfile | None)