Fix: Se actualizan dependencias para python3.12 y primeros pasos con pruebas

This commit is contained in:
2024-06-11 15:59:44 -05:00
parent c12d985f76
commit 6e5d358c73
7 changed files with 707 additions and 687 deletions

View File

@@ -4,7 +4,7 @@ import hashlib
from functools import reduce
import copy
import dataclasses
from dataclasses import dataclass
from dataclasses import dataclass, field
from datetime import datetime, date
from collections import defaultdict
import decimal
@@ -216,10 +216,10 @@ class PostalZone:
class Address:
name: str
street: str = ''
city: City = City('05001')
country: Country = Country('CO')
countrysubentity: CountrySubentity = CountrySubentity('05')
postalzone: PostalZone = PostalZone('')
city: City = field(default_factory=lambda: City('05001'))
country: Country = field(default_factory=lambda: Country('CO'))
countrysubentity: CountrySubentity = field(default_factory=lambda: CountrySubentity('05'))
postalzone: PostalZone = field(default_factory=lambda: PostalZone(''))
@dataclass
class PartyIdentification:
@@ -276,10 +276,10 @@ class Party:
responsability_code: typing.List[Responsability]
responsability_regime_code: str
organization_code: str
tax_scheme: TaxScheme = TaxScheme('01')
tax_scheme: TaxScheme = field(default_factory=lambda: TaxScheme('01'))
phone: str = ''
address: Address = Address('')
address: Address = field(default_factory=lambda: Address(''))
email: str = ''
legal_name: str = ''
legal_company_ident: str = ''
@@ -307,7 +307,7 @@ class TaxScheme:
class TaxSubTotal:
percent: float
scheme: typing.Optional[TaxScheme] = None
tax_amount: Amount = Amount(0.0)
tax_amount: Amount = field(default_factory=lambda: Amount(0.0))
def calculate(self, invline):
if self.percent is not None:
@@ -317,8 +317,8 @@ class TaxSubTotal:
@dataclass
class TaxTotal:
subtotals: list
tax_amount: Amount = Amount(0.0)
taxable_amount: Amount = Amount(0.0)
tax_amount: Amount = field(default_factory=lambda: Amount(0.0))
taxable_amount: Amount = field(default_factory=lambda: Amount(0.0))
def calculate(self, invline):
self.taxable_amount = invline.total_amount
@@ -338,17 +338,17 @@ class TaxTotalOmit(TaxTotal):
class WithholdingTaxSubTotal:
percent: float
scheme: typing.Optional[TaxScheme] = None
tax_amount: Amount = Amount(0.0)
tax_amount: Amount = field(default_factory=lambda: Amount(0.0))
def calculate(self, invline):
if self.percent is not None:
self.tax_amount = invline.total_amount * Amount(self.percent / 100)
@dataclass
class WithholdingTaxTotal:
subtotals: list
tax_amount: Amount = Amount(0.0)
taxable_amount: Amount = Amount(0.0)
tax_amount: Amount = field(default_factory=lambda: Amount(0.0))
taxable_amount: Amount = field(default_factory=lambda: Amount(0.0))
def calculate(self, invline):
self.taxable_amount = invline.total_amount
@@ -397,7 +397,7 @@ class PaymentMean:
@dataclass
class PrePaidPayment:
#DIAN 1.7.-2020: FBD03
paid_amount: Amount = Amount(0.0)
paid_amount: Amount = field(default_factory=lambda: Amount(0.0))
@dataclass
class BillingResponse:
@@ -454,17 +454,19 @@ class AllowanceChargeReason:
@dataclass
class AllowanceCharge:
#DIAN 1.7.-2020: FAQ03
# DIAN 1.7.-2020: FAQ03
charge_indicator: bool = True
amount: Amount = Amount(0.0)
amount: Amount = field(default_factory=lambda: Amount(0.0))
reason: AllowanceChargeReason = None
#Valor Base para calcular el descuento o el cargo
base_amount: typing.Optional[Amount] = Amount(0.0)
# Valor Base para calcular el descuento o el cargo
base_amount: typing.Optional[Amount] = field(
default_factory=lambda: Amount(0.0))
# Porcentaje: Porcentaje que aplicar.
multiplier_factor_numeric: Amount = Amount(1.0)
multiplier_factor_numeric: Amount = field(
default_factory=lambda: Amount(1.0))
def isCharge(self):
return self.charge_indicator == True
@@ -562,19 +564,19 @@ class InvoiceLine:
if self.tax is None:
self.tax = TaxTotalOmit()
if self.withholding is None:
self.withholding = WithholdingTaxTotalOmit()
@dataclass
class LegalMonetaryTotal:
line_extension_amount: Amount = Amount(0.0)
tax_exclusive_amount: Amount = Amount(0.0)
tax_inclusive_amount: Amount = Amount(0.0)
charge_total_amount: Amount = Amount(0.0)
allowance_total_amount: Amount = Amount(0.0)
payable_amount: Amount = Amount(0.0)
prepaid_amount: Amount = Amount(0.0)
line_extension_amount: Amount = field(default_factory=lambda: Amount(0.0))
tax_exclusive_amount: Amount = field(default_factory=lambda: Amount(0.0))
tax_inclusive_amount: Amount = field(default_factory=lambda: Amount(0.0))
charge_total_amount: Amount = field(default_factory=lambda: Amount(0.0))
allowance_total_amount: Amount = field(default_factory=lambda: Amount(0.0))
payable_amount: Amount = field(default_factory=lambda: Amount(0.0))
prepaid_amount: Amount = field(default_factory=lambda: Amount(0.0))
def calculate(self):
#DIAN 1.7.-2020: FAU14

View File

@@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
from ..amount import Amount
@@ -29,7 +29,7 @@ class Trabajador:
codigo_trabajador: str = None
otros_nombres: str = None
sub_tipo: SubTipoTrabajador = SubTipoTrabajador(code='00')
sub_tipo: SubTipoTrabajador = field(default_factory=lambda: SubTipoTrabajador(code='00'))
def apply(self, fragment):
fragment.set_attributes('./Trabajador',