aeat.application.modelo._work_plazo module

Application summaries for modelo work-unit filing deadlines.

This module turns a WorkUnit into the deadline summary used by the calculate CLI payload. It asks the registry deadline-window surface for the voluntary filing close date, derives either days_remaining or days_overdue against a reference date, and attaches the Ley 58/2003 art. 27 recargo band when the filing is late and the band table resolves.

An unknown registry deadline is deliberately represented as None rather than a blocking error. A recargo lookup failure still returns the overdue posture, logs the validation problem, and lets the rendering layer emit the generic extemporaneous-filing warning.

See also

aeat.domain.deadlines._plazo.resolve_filing_closes_on():

Registry-backed lookup for the plazo voluntario close date.

aeat.domain.deadlines._recargo.build_recovery_for_overdue():

Resolves the Art. 27 LGT recargo band for overdue filing.

aeat.entrypoints.cli._modelo_rendering.work_unit_deadline_output():

Projects this summary onto JSON payloads and warning notices.

class ModeloWorkRecargoSummary(band_id, surcharge_pct, interest_applies, legal_ref)[source]

Bases: object

Recargo band summary for an overdue modelo work unit.

The fields mirror the resolved deadline-domain recovery band: stable band id, surcharge percentage, interest applicability, and legal reference. The CLI renderer serialises this structure into the recargo block on the deadline payload.

Parameters:
band_id: str
surcharge_pct: Decimal
interest_applies: bool
legal_ref: str
class ModeloWorkPlazoSummary(closes_on, days_remaining=None, days_overdue=None, recargo=None)[source]

Bases: object

Filing-deadline summary for a modelo work unit.

closes_on is the voluntary filing close date. Exactly one posture should be populated by modelo_work_plazo_summary(): days_remaining for in-time filings, or days_overdue for late filings. recargo is present only when the overdue Art. 27 LGT band resolved successfully.

Parameters:
closes_on: date
days_remaining: int | None
days_overdue: int | None
recargo: ModeloWorkRecargoSummary | None
modelo_work_plazo_summary(work_unit, *, today=None)[source]

Return deadline and recargo posture for a WorkUnit, if known.

The work unit supplies the modelo, filing year, and typed period used to match a registry deadline window. When no window matches, the function returns None so callers can omit the deadline block. When the filing is still inside the voluntary window, the summary carries days_remaining. When the close date has passed, it carries days_overdue and, when available, a ModeloWorkRecargoSummary.

Parameters:
  • work_unit (WorkUnit) – The WorkUnit whose modelo, filing year, and Period select a registry filing window.

  • today (date | None) – Optional reference date for deterministic tests; defaults to date.today().

Return type:

ModeloWorkPlazoSummary | None

Returns:

A ModeloWorkPlazoSummary, or None when the registry has no deadline window for the work unit’s filing axis.

See also

aeat.entrypoints.cli._modelo_rendering._work_unit_deadline_output_from_summary():

Converts the summary into operator-facing payloads and notices.