aeat.application.modelo._external_import_actions module¶
External filing import actions for modelo baselines.
import_external_filing_evidence() turns
AEAT-attested external evidence into a presented
CalculationRevision plus current
ModeloRecord. Evidence-bearing imports validate the
referenced Justificante, stamp an
ExternalEvidence payload on the filing record,
supersede any prior current filing for the same target, and emit
modelo.filing.imported through
BucketEventHistoryRepository.
The imported record is the production baseline consumed by the amendment path.
It is intentionally distinct from a locally calculated and filed return:
external_evidence marks that the values came from official AEAT evidence,
while
external_filing_observations()
keeps the imported casilla values on the same registry-grounded
CasillaObservation contract as local
calculation revisions.
See also
filing_record_import():CLI surface that parses
filing-record importoptions and calls this service.amend_modelo_revision():Consumes the imported current
ModeloRecordas an amendment baseline.justificante:Receipt metadata store required by justificante-PDF, CSV-register, and live-capture evidence kinds.
reject_unknown_import_casillas():Resolves the registry snapshot and refuses noncanonical or undeclared imported casilla ids.
ExternalEvidence:Filing-record metadata that records the official evidence source.
- import_external_filing_evidence(*, work_unit_id, casilla_values, evidence_kind, evidence_reference_id, actor='aeat-import', work_unit_repository=None, calculation_repository=None, filing_repository=None, bucket_event_repository=None, justificante_repository=None, expected_tax_id=None, clock=None)[source]¶
Persist an externally-filed return and return its current
ModeloRecord.The target
WorkUnitsupplies the bucket, modelo, filing year, period, and registry revision used to validate imported casilla ids. Justificante-bound evidence kinds require a storedJustificantewhose modelo, year, period, and taxpayer id match the target.The service writes a
PRESENTADOCalculationRevisioncontaining the imported values and registry-grounded observations, creates aVIGENTEfiling record withExternalEvidence, supersedes any previous current filing for the same target, advances the work-unit pointers, and emitsmodelo.filing.imported.- Return type:
- Returns:
The new current
ModeloRecordcarrying the external evidence metadata.- Parameters:
work_unit_id (str)
evidence_kind (ExternalEvidenceKind)
evidence_reference_id (str)
actor (str)
work_unit_repository (WorkUnitCatalogueRepositoryProtocol | None)
calculation_repository (CalculationRevisionCatalogueRepositoryProtocol | None)
filing_repository (ModeloRecordCatalogueRepositoryProtocol | None)
bucket_event_repository (BucketEventHistoryRepositoryProtocol | None)
justificante_repository (JustificanteRepository | None)
expected_tax_id (str | None)
clock (datetime | None)
See also
external_filing_observations():Builds provenance-bearing observations for imported casilla values.
amend_modelo_revision():Requires this external-evidence baseline before filing amendments.
justificante:Stores the receipt metadata checked for receipt-bound evidence references.