aeat.application.modelo._amendment_actions module¶
Amendment actions for externally filed modelo baselines.
amend_modelo_revision() starts from a current, externally evidenced
ModeloRecord, builds a corrected
CalculationRevision with an explicit
CalculationRevisionAmendmentKind, supersedes the
baseline filing, and stores the new amendment record as current.
The side effects update the work-unit pointers and emit modelo.amended
through BucketEventHistoryRepository, matching the
event-history path used by imported and locally filed returns.
Only filing records carrying
ExternalEvidence can enter this path. The standard
local calculate -> verify -> file chain remains separate:
locally filed records have no external evidence and must be corrected through
their own re-file workflow. Amendment overrides are resolved against the target
registry snapshot, rejected when they use printed or undeclared casilla tokens,
and projected back onto the
CasillaObservation contract so the
new revision keeps legal/source provenance for both overridden and inherited
casillas.
See also
import_external_filing_evidence():Creates the AEAT-attested baseline that this module amends.
amendment_observations():Carries or rebuilds observation provenance for the corrected casilla map.
ExternalEvidence:Filing-record evidence marker required before this amendment path can run.
reject_unknown_override_casillas():Canonicalizes amendment override casilla ids against the registry.
reject_incomplete_amendment_casillas():Reuses the registry completeness gate before the amendment is filed.
- amend_modelo_revision(*, from_filing_record_id, overrides, amendment_kind, reason, actor, work_unit_repository=None, calculation_repository=None, filing_repository=None, bucket_event_repository=None, clock=None)[source]¶
Build and file an amendment over an externally filed return.
from_filing_record_idmust identify the currentModeloRecordfor an imported AEAT-attested baseline. The baseline’sCalculationRevisionsupplies the full casilla map;overridesreplace only corrected casillas after registry validation, while unchanged casillas are inherited. The resulting revision records the requestedCalculationRevisionAmendmentKind, stores the strippedreason, receives registry-grounded observations, transitions throughVERIFICADO_COMPLETOtoPRESENTADO, and becomes the current filed revision for theWorkUnit.The baseline filing is marked
SUPERSEDIDOand linked to the new current amendment record. The new filing record is an internal filing envelope:aeat_acceptedremains false,external_evidenceis cleared, andamends_filing_record_idpoints back to the imported baseline. Amodelo.amendedbucket event records the amendment kind, override count, work-unit id, and amended baseline id.- Return type:
- Returns:
The new current
ModeloRecordfor the amended return.- Parameters:
from_filing_record_id (str)
amendment_kind (CalculationRevisionAmendmentKind)
reason (str)
actor (str)
work_unit_repository (WorkUnitCatalogueRepositoryProtocol | None)
calculation_repository (CalculationRevisionCatalogueRepositoryProtocol | None)
filing_repository (ModeloRecordCatalogueRepositoryProtocol | None)
bucket_event_repository (BucketEventHistoryRepositoryProtocol | None)
clock (datetime | None)
See also
aeat app modelo work amend:CLI command that validates
--from-filing-record,--kind,--reason, and--setbefore calling this service.import_external_filing_evidence():Production import path that creates accepted external-evidence baselines.
amendment_observations():Builds the
CasillaObservationrows persisted on the amendment revision.