cfdibills.schemas.mixins.CFDIMixin

class cfdibills.schemas.mixins.CFDIMixin[source]

Bases: object

Behavior to be extended by a CFDI. This mixin is meant to be used with any version of CFDI.

__init__()

Methods

__init__()

get_complemento(complemento_type)

Retrieves the complemento of type complemento_type.

get_total_transferred_tax(tax_type)

Computes the total tax transferred (from impuestos.traslados) of type tax_type.

get_total_withheld_tax(tax_type)

Computes the total tax get_total_withheld_tax (from impuestos.retenciones) of type tax_type.

Attributes

complemento

Type stub of CFDIx.complemento

impuestos

Type stub of CFDIx.impuestos

complemento: List[Union[cfdibills.schemas.complementos.TimbreFiscalDigital, cfdibills.schemas.complementos.Aerolineas, cfdibills.schemas.complementos.CertificadoDeDestruccion, cfdibills.schemas.complementos.ComercioExterior, Dict]] = []

Type stub of CFDIx.complemento

get_complemento(complemento_type: Type[cfdibills.schemas.complementos.AnyComplementoType]) cfdibills.schemas.complementos.AnyComplementoType[source]

Retrieves the complemento of type complemento_type.

Parameters

complemento_type (Type[AnyComplementoType]) – Type of complemento to find.

Returns

Complemento found in this CFDI of type complemento_type

Return type

AnyComplementoType

Raises

ComplementoNotFoundError – When the CFDI doesn’t contain a complemento of type complemento_type

get_total_transferred_tax(tax_type: cfdibills.schemas.catalogs.Impuesto) float[source]

Computes the total tax transferred (from impuestos.traslados) of type tax_type.

Parameters

tax_type (Impuesto) – Type of tax to sum.

Returns

Sum of all the transferred taxes of type tax_type.

Return type

float

get_total_withheld_tax(tax_type: cfdibills.schemas.catalogs.Impuesto) float[source]

Computes the total tax get_total_withheld_tax (from impuestos.retenciones) of type tax_type.

Parameters

tax_type (Impuesto) – Type of tax to sum.

Returns

Sum of all the withheld taxes of type tax_type.

Return type

float

impuestos: Optional[cfdibills.schemas.mixins._ImpuestosProto]

Type stub of CFDIx.impuestos