cadrumo.application.modelo.result_disposition_resolution module¶
Single determined-fact resolution of a modelo’s fichero result disposition.
The AEAT fichero “Tipo de declaración” encodes the result disposition of an
autoliquidación (a ingresar / a compensar / a devolver / negativa). For Modelo
303 a negative result is, by default, a credit carried forward (compensación,
C). Inscription in the Registro de devolución mensual (REDEME) is treated
as the standing monthly-devolución disposition policy for eligible negative
periods; a non-REDEME taxpayer may explicitly request devolución (D) only
in the last filing period of the year.
This module is the ONE place that determination is made. The export header
composer and the cross-period carry persistence both read the disposition from
resolve_modelo_result_disposition(), so the fichero D the operator
submits and the cross-period carry the next period reads can never disagree (a
period requested as devolución is excluded from compensación carry - never
both). It reuses the per-modelo result→code derivation
(derive_result_disposition()) and the REDEME/last-period
eligibility gate (refund_disposition_available()); it does
not duplicate either.
Before resolving the result, the persisted CalculationRevision value map
is checked through the parent WorkUnit against the law-determined
registry ModeloRevision, so printed numbers, export refs, and ambiguous
metadata tokens fail before they can influence the disposition.
Legal basis (Modelo 303 refund election): RD 1624/1992 (RIVA) art. 30 (Registro de devolución mensual); Ley 37/1992 (LIVA) art. 116 (the monthly-refund right).
See also
core.result_disposition.derive_result_disposition()Diseño-grounded result-to-code derivation used before Modelo 303 refund election handling.
domain.iva.refund_eligibility.refund_disposition_available()Law-determined REDEME/last-period eligibility gate layered on a carried Modelo 303 credit.
application.modelo.filing_actions.file_modelo_revision()Filing transition that reads the same refund fact before persisting cross-period carry-forward observations.
- DECLARATION_TYPE_FALLBACK: ResultDisposition¶
Provisional fallback “Tipo de declaración” disposition for a modelo that declares the header but has no diseño-grounded result-disposition spec.
INGRESO(“I”) is wrong for a credit/zero result, so a new modelo MUST be added to the spec rather than relying on it. Mirrors the export fallback constant — kept here because the resolver is the disposition authority.
- resolve_modelo_result_disposition(*, work_unit, revision, workflow_profile, period, refund_election=RefundElection.COMPENSAR, payment_election=PaymentElection.INGRESO, operation=None)[source]¶
Resolve the single fichero “Tipo de declaración” result disposition.
The boundary resolves a persisted
CalculationRevisionthrough its parentWorkUnitfor aTaxpayerProfile, using the suppliedPeriodto decide whether a Modelo 303 refund election is lawful. The work unit fixes the modelo, filing year, and registry revision against which the revision’scasilla_valuesare validated.Computes the modelo’s base disposition from its final-result casilla via
derive_result_disposition(), then — for a Modelo 303 credit (C) — applies the refund election: a taxpayer inscribed in the Registro de devolución mensual (REDEME) is treated as requesting devolución (D) for eligible negative periods under a standing monthly-devolución disposition policy; a non-REDEME taxpayer who explicitly electsDEVOLVERrequests devolución for the negative last period of the year (Ley 37/1992 art. 116). The eligibility gate (refund_disposition_available()) confirms the refund is lawful for the period. Every other disposition is returned unchanged.refund_electionis the operator’s per-filing opt-in (defaultRefundElection, the non-regressive carry-forward). It is orthogonal to the standing REDEME inscription: REDEME is treated as the standing policy that resolves eligible negative periods to devolución regardless of this flag, while a non-REDEME taxpayer resolves to devolución only when both the period is eligible AND the operator electsDEVOLVER. An election ofDEVOLVERfor an ineligible period is refused — never silently carried, never silently requested as devolución.Returns the one
ResultDispositionboth the export header composer and the cross-period carry persistence read, so the fichero disposition and the carry can never disagree.- Raises:
ModeloRefundElectionNotEligibleError – When
refund_electionisDEVOLVERbut the period is not a lawful refund period for a non-REDEME taxpayer.- Return type:
- Parameters:
work_unit (WorkUnit)
revision (CalculationRevision)
workflow_profile (TaxpayerProfile)
period (Period)
refund_election (RefundElection)
payment_election (PaymentElection)
operation (PinnedAuthorityOperation | None)
- base_modelo_result_disposition(*, work_unit, revision, period, operation)[source]¶
Return the disposition the final-result casilla implies before any operator election.
- Parameters:
work_unit (
WorkUnit) – The filing coordinate naming the modelo and its revision.revision (
CalculationRevision) – TheCalculationRevisionwhose result casilla decides the sign.period (
Period) – The period the disposition is resolved for.operation (
PinnedAuthorityOperation) – The generation-pinned authority the casillas are read under.
- Return type:
- Returns:
The derived disposition, or the declared fallback when the modelo has none.