cadrumo.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 the application-owned bucket-event capability, 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.
Core types:
RegistrySnapshot.
- amend_modelo_revision(*, from_filing_record_id, overrides, amendment_kind, m303_rectificativa_motive=None, detail_rows=None, reason, actor, ports, clock=None, operation=None, result_disposition=None)[source]¶
Build and file an amendment of the period’s latest AEAT-confirmed declaration.
from_filing_record_idmust identify the in-forceModeloRecordof the period, confirmed or still pending. ItsCalculationRevisionsupplies the full casilla map;overridesreplace only corrected casillas after registry validation, while unchanged casillas are inherited. The amendment references the latest confirmed declaration; a pending in-force entry is markedDESCARTADA, and with no confirmed declaration the amendment is refused. 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 confirmed baseline is linked to the new current amendment record. The new filing record is an internal filing envelope: the record stays
PENDIENTE,external_evidenceis cleared, andamends_filing_record_idpoints back to the baseline. The amendment’s observations are written to the pending-local layer, and amodelo.amendedbucket event records the amendment kind, override count, work-unit id, amended baseline id and any discarded entry, all in one unit of work.result_dispositionis the Modelo 303 declaration disposition of the correction; when omitted, the period’s effective recorded disposition is kept.- Return type:
- Returns:
The new current
ModeloRecordfor the amended return.- Parameters:
from_filing_record_id (str)
amendment_kind (CalculationRevisionAmendmentKind)
m303_rectificativa_motive (M303RectificativaMotive | None)
detail_rows (Sequence[Modelo184MemberRow | Modelo232VinculadaRow | Modelo349OperadorRow | Modelo349RectificacionRow | Modelo347ContraparteRow | Modelo210AgrupacionRentaRow] | None)
reason (str)
actor (str)
ports (AmendmentActionPorts)
clock (datetime | None)
operation (PinnedAuthorityOperation | None)
result_disposition (ResultDisposition | 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.