aeat.domain.fincas._amortization_ledger module

LIRPF art. 23.1.f amortización 3 % multi-year ledger.

Per-finca per-period amortización accrual with cumulative-through- year cap tracking. The depreciable basis at year N is max(coste_adquisicion_construccion, valor_catastral_construccion); the per-year accrual is basis * 3 % * dias_alquilados / 365, clamped down so the cumulative-through-year never exceeds coste_adquisicion_construccion.

Default behaviour clamps to the remaining cap and never raises. Strict callers (preflight verifiers that surface the cap on the filing surface) opt in via strict=True and receive AmortizationLedgerCapExceededError when an accrual would overflow.

ART_23_1_F_RATE: Decimal

3 % amortización of capital-inmobiliario rental properties; rate fixed by RD 439/2007 (RIRPF) art. 14.2.a; deductibility base Ley 35/2006 art. 23. Re-export alias for AMORTIZACION_INMUEBLE_RATE.

DAYS_PER_YEAR: Decimal

Pro-rate denominator. The BOE wording uses “anual” — we adopt 365 days for every year (including leap years), matching AEAT’s manual práctico Renta worked-example convention.

class AmortizationComputation(**data)[source]

Bases: BaseModel

Outcome of a single compute_amortization_for_year() invocation.

Variables:
  • period_year – Ejercicio.

  • basis – Depreciable basis used (max(coste_construccion, valor_catastral_construccion)).

  • gross_amortizationbasis * 0.03 * dias_alquilados / 365, rounded to cents — what would accrue if the cap were not in play.

  • capped_amortization – Final accrual after clamping at the remaining cap. Equal to gross_amortization when no clamp applied.

  • cumulative_through_year – Cumulative-through-year sum (including the current accrual).

  • clamp_appliedTrue when the cap reduced the gross amortización below its theoretical value.

Parameters:
period_year: int
basis: Decimal
gross_amortization: Decimal
capped_amortization: Decimal
cumulative_through_year: Decimal
clamp_applied: bool
compute_amortization_for_year(finca, income, *, cumulative_through_prior_year, strict=False)[source]

Compute the per-finca per-year amortización 3 % entry.

Parameters:
  • finca (Finca) – Owning Finca.

  • income (FincaRendimientoRecord) – Income record for the same finca/contract for the target period — provides period_year and dias_alquilados.

  • cumulative_through_prior_year (Decimal) – Sum of prior years’ capped_amortization for this finca. The caller (the ledger orchestrator) sources this from the persisted ledger.

  • strict (bool) – When True and the gross accrual would push cumulative beyond coste_adquisicion_construccion, raise AmortizationLedgerCapExceededError instead of clamping.

Return type:

AmortizationComputation

Returns:

An AmortizationComputation carrying the per-year result.

Raises:

AmortizationLedgerCapExceededError – When strict is True and the gross accrual would overflow the cap.

computation_to_ledger_entry(finca_id, income, computation)[source]

Project an AmortizationComputation into a persistable record.

Return type:

FincaAmortizacionLedgerEntry

Returns:

A FincaAmortizacionLedgerEntry ready for persistence.

Parameters: