aeat.domain.modelos._dt12_reduccion module

DT 12ª LIRPF plan-de-pensiones capital-rescate reducción.

The 40% reducción on the part of a plan-de-pensiones capital rescate attributable to contributions made on or before 31-12-2006 (LIRPF Disposición Transitoria 12ª). compute_dt12_reduccion_plan_pensiones() accepts Decimal amounts, applies DT12_RESCATE_REDUCCION_RATE, rounds with aeat.core.money.round_to_cents(), and raises PensionReduccionError for invalid preconditions.

DT 12ª apartado 4 (added by Ley 26/2014, BOE-A-2014-12327) restricts the whole transitional régimen — and therefore the 40% reducción — to prestaciones percibidas within a time window measured from the contingencia year. dt12_regime_window_eligibility() is the pure predicate implementing the three verbatim apartado-4 branches; it is consumed by the calculate-shortcut path to fact-gate the injection (withhold the reducción when the declared years prove the window closed), never by forking the core compute.

compute_dt12_reduccion_plan_pensiones(*, gross_rescate, aportaciones_pre_2007, aportaciones_totales)[source]

Compute the DT 12ª LIRPF 40% reducción for a plan-de-pensiones capital rescate.

Formula (LIRPF DT 12ª): pre_2007 / totales * gross_rescate * 40%. The result is rounded to 2 decimal places (money-2 per the registry convention).

Raises:

PensionReduccionError – When aportaciones_totales is zero or negative (division-by-zero guard), when any input is negative, or when aportaciones_pre_2007 exceeds aportaciones_totales (DT 12ª apartado 2 scopes the reduced part to contributions made up to 31-12-2006, a subset of the total, so its share cannot exceed 1).

Return type:

Decimal

Parameters:
class Dt12WindowBranch(*values)[source]

Bases: StrEnum

Which LIRPF DT 12ª apartado-4 branch governs a rescate’s eligibility window.

Variables:
  • GENERAL – Contingencia in 2015 or later — the general rule: eligible in the ejercicio the contingencia occurs plus the two following.

  • TRANSITIONAL_2011_2014 – Contingencia in 2011–2014 — eligible through the end of the eighth following ejercicio.

  • CLIFF_2010_OR_EARLIER – Contingencia in 2010 or earlier — eligible only through the 31-12-2018 cliff.

GENERAL
TRANSITIONAL_2011_2014
CLIFF_2010_OR_EARLIER
class Dt12WindowEligibility(contingencia_year, rescate_year, branch, eligible, eligible_through_year)[source]

Bases: object

Typed verdict of the LIRPF DT 12ª apartado-4 time-window predicate.

Variables:
  • contingencia_year – The year the contingencia (retirement, disability, death) occurred, as declared by the operator.

  • rescate_year – The year the prestación is percibida (normally the filing year).

  • branch – The Dt12WindowBranch the contingencia year selects.

  • eligible – Whether the rescate falls inside the apartado-4 window and may therefore apply the 40% reducción.

  • eligible_through_year – The last ejercicio in which a rescate for this contingencia year may still apply the régimen.

Parameters:
contingencia_year: int
rescate_year: int
branch: Dt12WindowBranch
eligible: bool
eligible_through_year: int
dt12_regime_window_eligibility(*, contingencia_year, rescate_year)[source]

Evaluate the LIRPF DT 12ª apartado-4 time-window eligibility (pure predicate).

Apartado 4 (added by Ley 26/2014 art. 1.86, BOE-A-2014-12327) restricts the transitional régimen — and therefore the 40% reducción — to prestaciones percibidas within a window measured from the contingencia year:

  • Contingencia in 2015 or later (general rule): eligible in the ejercicio the contingencia occurs “o en los dos ejercicios siguientes”, i.e. contingencia_year <= rescate_year <= contingencia_year + 2.

  • Contingencia in 2011–2014: eligible “hasta la finalización del octavo ejercicio siguiente”, i.e. contingencia_year <= rescate_year <= contingencia_year + 8.

  • Contingencia in 2010 or earlier: eligible “hasta el 31 de diciembre de 2018”, i.e. contingencia_year <= rescate_year <= 2018.

A rescate percibida before the contingencia year (rescate_year < contingencia_year) is never eligible: the window opens with the contingency.

Parameters:
  • contingencia_year (int) – The year the contingencia occurred.

  • rescate_year (int) – The year the prestación is percibida.

Return type:

Dt12WindowEligibility

Returns:

A Dt12WindowEligibility verdict carrying the governing branch, the eligibility flag, and the last eligible ejercicio.

Raises:

PensionReduccionError – When either year is not a positive four-digit-era year (a defensive guard against transposed or unset inputs).