Compatibilidad con Python 3.13
- Actualiza dependencias: cryptography>=41.0.0, pyOpenSSL>=23.2.0, xmlsec>=1.3.12, xmlsig>=0.1.9, zeep>=4.2.1, lxml>=5.2.2 - Anade monkey-patch para xades.load_pkcs12 con pyOpenSSL >= 24 (PKCS12 eliminado de OpenSSL.crypto) - Reemplaza datetime.utcnow() por datetime.now(timezone.utc) - Reemplaza APIs deprecadas de lxml en facho.py y codelist - Migra verificacion PKCS12 de pyOpenSSL a cryptography API en fe.py - Moderniza typing: Union/Optional/List a sintaxis | y list[] - Actualiza requirements_dev.txt con versiones recientes - Actualiza tox.ini y Makefile.dev para Python 3.13
This commit is contained in:
@@ -11,7 +11,6 @@ from datetime import datetime, date
|
||||
# from collections import defaultdict
|
||||
import decimal
|
||||
from decimal import Decimal
|
||||
import typing
|
||||
from ..data.dian import codelist
|
||||
|
||||
DECIMAL_PRECISION = 6
|
||||
@@ -60,7 +59,7 @@ class AmountCollection(Collection):
|
||||
|
||||
class Amount:
|
||||
def __init__(
|
||||
self, amount: typing.Union[int, float, str, "Amount"],
|
||||
self, amount: int | float | str | "Amount",
|
||||
currency: Currency = Currency('COP')):
|
||||
|
||||
# DIAN 1.7.-2020: 1.2.3.1
|
||||
@@ -294,7 +293,7 @@ class TaxScheme:
|
||||
class Party:
|
||||
name: str
|
||||
ident: str
|
||||
responsability_code: typing.List[Responsability]
|
||||
responsability_code: list[Responsability]
|
||||
responsability_regime_code: str
|
||||
organization_code: str
|
||||
tax_scheme: TaxScheme = field(default_factory=lambda: TaxScheme('01'))
|
||||
@@ -327,7 +326,7 @@ class TaxScheme:
|
||||
@dataclass
|
||||
class TaxSubTotal:
|
||||
percent: float
|
||||
scheme: typing.Optional[TaxScheme] = None
|
||||
scheme: TaxScheme | None = None
|
||||
tax_amount: Amount = field(default_factory=lambda: Amount(0.0))
|
||||
|
||||
def calculate(self, invline):
|
||||
@@ -359,7 +358,7 @@ class TaxTotalOmit(TaxTotal):
|
||||
@dataclass
|
||||
class WithholdingTaxSubTotal:
|
||||
percent: float
|
||||
scheme: typing.Optional[TaxScheme] = None
|
||||
scheme: TaxScheme | None = None
|
||||
tax_amount: Amount = field(default_factory=lambda: Amount(0.0))
|
||||
|
||||
def calculate(self, invline):
|
||||
@@ -491,7 +490,7 @@ class AllowanceCharge:
|
||||
reason: AllowanceChargeReason = None
|
||||
|
||||
# Valor Base para calcular el descuento o el cargo
|
||||
base_amount: typing.Optional[Amount] = field(
|
||||
base_amount: Amount | None = field(
|
||||
default_factory=lambda: Amount(0.0))
|
||||
|
||||
# Porcentaje: Porcentaje que aplicar.
|
||||
@@ -536,9 +535,9 @@ class InvoiceLine:
|
||||
# ya que al reportar los totales es sobre
|
||||
# la factura y el percent es unico por type_code
|
||||
# de subtotal
|
||||
tax: typing.Optional[TaxTotal]
|
||||
withholding: typing.Optional[WithholdingTaxTotal]
|
||||
allowance_charge: typing.List[AllowanceCharge] = dataclasses.field(
|
||||
tax: TaxTotal | None
|
||||
withholding: WithholdingTaxTotal | None
|
||||
allowance_charge: list[AllowanceCharge] = dataclasses.field(
|
||||
default_factory=list)
|
||||
|
||||
def add_allowance_charge(self, charge):
|
||||
|
||||
Reference in New Issue
Block a user