Skip to content

Commit 577fcf7

Browse files
authored
Merge pull request #208 from fyntex/feature/add-fecha-firma-dt-validation
rtc.data_models_aec: remove match validation for 'fecha_firma_dt' and 'fecha_cesion_dt'
2 parents d9e4eab + e1eeb68 commit 577fcf7

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

cl_sii/rtc/data_models_aec.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,12 @@ def validate_last_cesion_matches_some_fields(
746746
) -> Mapping[str, object]:
747747
field_validations: Sequence[Tuple[str, str]] = [
748748
# (AecXml field, CesionAecXml field):
749-
('fecha_firma_dt', 'fecha_cesion_dt'),
749+
# Even though it seems reasonable to expect that the date in `fecha_firma_dt`
750+
# in the AEC is later than the date in `fecha_cesion_dt`, we know of cases of
751+
# AEC approved by the SII in which this is not fulfilled, we observe cases
752+
# where the date in `fecha_firma_dt` was later or even before the date in
753+
# `fecha_cesion_dt` by a difference of up to 6 hours.
754+
# ('fecha_firma_dt', 'fecha_cesion_dt'),
750755
('cedente_rut', 'cedente_rut'),
751756
('cesionario_rut', 'cesionario_rut'),
752757
]

tests/test_rtc_data_models_aec.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -660,24 +660,18 @@ def test_validate_last_cesion_matches_some_fields(self) -> None:
660660
{
661661
'loc': ('__root__',),
662662
'msg':
663-
"'fecha_cesion_dt' of last 'cesion' must match 'fecha_firma_dt':"
664-
" datetime.datetime("
665-
"2019, 4, 5, 12, 57, 32,"
666-
" tzinfo=<DstTzInfo 'America/Santiago' -03-1 day, 21:00:00 DST>"
667-
")"
663+
"'cedente_rut' of last 'cesion' must match 'cedente_rut':"
664+
" Rut('76389992-6')"
668665
" !="
669-
" datetime.datetime("
670-
"2019, 4, 5, 12, 0, 32,"
671-
" tzinfo=<DstTzInfo 'America/Santiago' -03-1 day, 21:00:00 DST>"
672-
").",
666+
" Rut('76598556-0').",
673667
'type': 'value_error',
674668
},
675669
]
676670

677671
with self.assertRaises(pydantic.ValidationError) as assert_raises_cm:
678672
dataclasses.replace(
679673
obj,
680-
fecha_firma_dt=obj.fecha_firma_dt.replace(minute=0), # Original minute is 57.
674+
cedente_rut=obj.cesionario_rut,
681675
)
682676

683677
validation_errors = assert_raises_cm.exception.errors()

0 commit comments

Comments
 (0)