cadrumo.application.modelo.prior_domiciliation module

Fail-closed authority for Modelo 303’s prior-domiciliation marker.

The page-three X marker is not a statement about the return currently being exported. It asks AEAT to cancel or modify a direct debit established by the externally attested baseline being rectified. This module therefore requires a persisted, source-header-derived U observation joined by the baseline’s justificante CSV; a computed amount, a current profile, or an old local export cannot substitute for that official evidence.

The baseline is read from the ModeloRecord that filed it and the CalculationRevision that produced its figures — both persisted, so the marker rests on what was actually filed rather than on what the current export would compute.

resolveprior_domiciliation_election(*, election, work_unit, revision, filing_repository, observation_repository, operation)[source]

Return safe election provenance, refusing any unproven X request.

KEEP is intentionally a neutral no-proof default. CANCEL_OR_MODIFY requires the rectificativa’s explicit amendment link, an externally evidenced baseline record, and the official same-target filed observation that carries the exact baseline CSV and a submitted-file U header.

The proof runs as an ordered chain of refusals, each stage narrowing what the next may assume. Order is load-bearing rather than cosmetic: the baseline link is what the filing lookup needs, the filing is what the observation join keys on, and the header is what the disposition below is checked against – so no stage can be reordered without weakening the one after it.

revision is the draft CalculationRevision being exported; it supplies the amendment link the chain starts from and never the proof itself, which is why a computed figure cannot stand in for the baseline.

Return type:

PriorDomiciliationElectionProjection

Parameters: