cadrumo.application.calculations.m303_carry_ingress module

Canonical Modelo 303 carry ingress for authoritative filing evidence.

The declaration’s Tipo de declaración is evidence in the submitted-file header, not a registry casilla. This module is the only place that turns that evidence (or the local filing boundary’s already-resolved equivalent) into the typed envelope disposition used to normalize the carry pair. It intentionally does not make any annual, history, or wallet decision: those later consumers must read this persisted contract rather than recover an election themselves.

Core types: CasillaObservation.

m303_declaration_type_header_key(*, filing_year, period, operation)[source]

Resolve the declaration-type header key for one governed M303 filing scope.

Return type:

str

Parameters:
M303_CARRY_ERROR_NAMESPACE

The one namespace every M303 carry ingress refusal is keyed under.

exception M303CarryIngressError(message=None, *, context=None, translated_message=None, precondition_verdict=None)[source]

Bases: TerminalPreconditionErrorMixin, CoreValidationError

Modelo 303 carry evidence was insufficient or internally contradictory.

A refusal reporting two sources of the same declared amount that disagree attaches a SAFETY PreconditionVerdict, because choosing either side silently changes the compensación the taxpayer carries forward. An evidence-incomplete refusal carries no verdict: the operator fixes it by supplying the missing evidence.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

  • precondition_verdict (VerdictT | None)

Return type:

None

code
normalize_m303_carry_observation_envelope(envelope, *, operation)[source]

Resolve and persist the sole disposition-aware M303 carry projection.

Official AEAT evidence must contain exactly one registry-selected header. Local app evidence must carry the typed result determined at the filing boundary. Both paths converge here, where the result sign, supplied typed projection, and the normalized available/generated pair are checked before a later reader can treat the observation as carry evidence.

Return type:

ObservationEnvelopePayload

Parameters:
validate_normalized_m303_carry_observation_envelope(envelope, *, operation)[source]

Require an envelope to already carry the canonical M303 pair.

History consumes persisted evidence rather than performing a second normalization. Re-running the ingress independently establishes what the canonical projection would be; requiring it to equal the supplied envelope prevents a caller from selecting either semantic amount after validation. Every supported Modelo 303 writer produces this canonical shape; an unnormalized payload is invalid persisted state, not a compatibility form.

Return type:

ObservationEnvelopePayload

Parameters:
resolve_available_compensation_formula_id(revision, derivation, *, registry_mapping=None)[source]

Return the registry formula id backing a generated-basis available projection.

A resultado-basis derivation carries no operands and so cites no formula.

Core types: ModeloRevision.

Return type:

str | None

Parameters: