Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies = [
"pyOpenSSL>=24.0.0",
"pytz>=2019.3",
"signxml>=4.0.0",
"typing-extensions>=4.0.1",
]
requires-python = ">=3.8, <3.11"
authors = [
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ pydantic==2.10.4
pyOpenSSL==24.3.0
pytz==2024.2
signxml==4.0.3
typing-extensions==4.12.2
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ sqlparse==0.5.0
# via django
typing-extensions==4.12.2
# via
# -r requirements.in
# annotated-types
# asgiref
# pydantic
Expand Down
7 changes: 4 additions & 3 deletions src/cl_sii/dte/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from typing import Mapping, Optional, Sequence

import pydantic
from typing_extensions import Self

import cl_sii.contribuyente.constants
import cl_sii.rut.constants
Expand Down Expand Up @@ -854,7 +855,7 @@ def validate_referencias_numero_linea_ref_order(cls, v: object) -> object:
@pydantic.model_validator(mode='after')
def validate_referencias_rut_otro_is_consistent_with_tipo_dte(
self, info: pydantic.ValidationInfo
) -> DteXmlData:
) -> Self:
referencias = self.referencias
tipo_dte = self.tipo_dte

Expand All @@ -880,7 +881,7 @@ def validate_referencias_rut_otro_is_consistent_with_tipo_dte(
@pydantic.model_validator(mode='after')
def validate_referencias_rut_otro_is_consistent_with_emisor_rut(
self, info: pydantic.ValidationInfo
) -> DteXmlData:
) -> Self:
referencias = self.referencias
emisor_rut = self.emisor_rut

Expand All @@ -900,7 +901,7 @@ def validate_referencias_rut_otro_is_consistent_with_emisor_rut(
return self

@pydantic.model_validator(mode='after')
def validate_referencias_codigo_ref_is_consistent_with_tipo_dte(self) -> DteXmlData:
def validate_referencias_codigo_ref_is_consistent_with_tipo_dte(self) -> Self:
referencias = self.referencias
tipo_dte = self.tipo_dte

Expand Down
3 changes: 2 additions & 1 deletion src/cl_sii/rcv/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from typing import ClassVar, Optional

import pydantic
from typing_extensions import Self

import cl_sii.dte.data_models
from cl_sii.base.constants import SII_OFFICIAL_TZ
Expand Down Expand Up @@ -174,7 +175,7 @@ def validate_datetime_tz(cls, v: object) -> object:
return v

@pydantic.model_validator(mode='after')
def validate_rcv_kind_is_consistent_with_rc_estado_contable(self) -> RcvDetalleEntry:
def validate_rcv_kind_is_consistent_with_rc_estado_contable(self) -> Self:
rcv_kind = self.RCV_KIND
rc_estado_contable = self.RC_ESTADO_CONTABLE

Expand Down
5 changes: 3 additions & 2 deletions src/cl_sii/rtc/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from typing import ClassVar, Mapping, Optional

import pydantic
from typing_extensions import Self

from cl_sii.base.constants import SII_OFFICIAL_TZ
from cl_sii.dte import data_models as dte_data_models
Expand Down Expand Up @@ -508,7 +509,7 @@ def validate_monto_cedido(cls, v: object) -> object:
return v

@pydantic.model_validator(mode='after')
def validate_monto_cedido_does_not_exceed_dte_monto_total(self) -> CesionL1:
def validate_monto_cedido_does_not_exceed_dte_monto_total(self) -> Self:
monto_cedido = self.monto_cedido
dte_monto_total = self.dte_monto_total

Expand Down Expand Up @@ -705,7 +706,7 @@ def validate_contribuyente_razon_social(cls, v: object) -> object:
return v

@pydantic.model_validator(mode='after')
def validate_dte_data_l2(self) -> CesionL2:
def validate_dte_data_l2(self) -> Self:
dte_key = self.dte_key
try:
# Note: Delegate some validation to 'dte_data_models.DteDataL2'.
Expand Down
13 changes: 7 additions & 6 deletions src/cl_sii/rtc/data_models_aec.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from typing import ClassVar, Mapping, Optional, Sequence, Tuple

import pydantic
from typing_extensions import Self

from cl_sii.base.constants import SII_OFFICIAL_TZ
from cl_sii.dte import data_models as dte_data_models
Expand Down Expand Up @@ -342,7 +343,7 @@ def validate_datetime_tz(cls, v: object) -> object:
return v

@pydantic.model_validator(mode='after')
def validate_fecha_cesion_dt_is_consistent_with_dte(self) -> CesionAecXml:
def validate_fecha_cesion_dt_is_consistent_with_dte(self) -> Self:
fecha_cesion_dt = self.fecha_cesion_dt
dte = self.dte

Expand All @@ -352,7 +353,7 @@ def validate_fecha_cesion_dt_is_consistent_with_dte(self) -> CesionAecXml:
return self

@pydantic.model_validator(mode='after')
def validate_monto_cesion_does_not_exceed_dte_monto_total(self) -> CesionAecXml:
def validate_monto_cesion_does_not_exceed_dte_monto_total(self) -> Self:
monto_cesion = self.monto_cesion
dte = self.dte

Expand All @@ -365,7 +366,7 @@ def validate_monto_cesion_does_not_exceed_dte_monto_total(self) -> CesionAecXml:
return self

@pydantic.model_validator(mode='after')
def validate_fecha_ultimo_vencimiento_is_consistent_with_dte(self) -> CesionAecXml:
def validate_fecha_ultimo_vencimiento_is_consistent_with_dte(self) -> Self:
fecha_ultimo_vencimiento = self.fecha_ultimo_vencimiento
dte = self.dte

Expand Down Expand Up @@ -732,7 +733,7 @@ def validate_cesiones_seq_order(cls, v: object) -> object:
# return v

@pydantic.model_validator(mode='after')
def validate_dte_matches_cesiones_dtes(self) -> AecXml:
def validate_dte_matches_cesiones_dtes(self) -> Self:
dte = self.dte
cesiones = self.cesiones

Expand All @@ -751,7 +752,7 @@ def validate_dte_matches_cesiones_dtes(self) -> AecXml:
return self

@pydantic.model_validator(mode='after')
def validate_last_cesion_matches_some_fields(self) -> AecXml:
def validate_last_cesion_matches_some_fields(self) -> Self:
field_validations: Sequence[Tuple[str, str]] = [
# (AecXml field, CesionAecXml field):
# Even though it seems reasonable to expect that the date in `fecha_firma_dt`
Expand Down Expand Up @@ -784,7 +785,7 @@ def validate_last_cesion_matches_some_fields(self) -> AecXml:
@pydantic.model_validator(mode='after')
def validate_signature_value_and_signature_x509_cert_der_may_only_be_none_together(
self,
) -> AecXml:
) -> Self:
signature_value = self.signature_value
signature_x509_cert_der = self.signature_x509_cert_der

Expand Down
Loading