facho/fe/form.py: se adicionan mas elementos xml

FossilOrigin-Name: 6a923fcac4b5182f5e4954d35812c1efdedbc6f461a3376781293d2aa69cf030
This commit is contained in:
bit4bit@riseup.net 2020-05-31 02:54:05 +00:00
parent 1df99f4c9d
commit b6d21aab96
2 changed files with 31 additions and 6 deletions

View File

@ -10,6 +10,19 @@ from datetime import datetime
from .data.dian import codelist
from . import fe
@dataclass
class Country:
code: str
name: str
@dataclass
class Address:
name: str
street: str = ''
city: str = ''
department: str = ''
country: Country = Country('CO', 'COLOMBIA')
@dataclass
class Party:
name: str
@ -18,7 +31,7 @@ class Party:
organization_code: str
phone: str = ''
address: str = ''
address: Address= Address('')
email: str = ''
legal_name: str = ''
legal_company_ident: str = ''
@ -210,8 +223,13 @@ class DIANInvoiceXML(fe.FeXML):
invoice.invoice_supplier.name)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationName',
invoice.invoice_supplier.legal_name)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationAddress/cbc:CityName', invoice.invoice_supplier.address.city)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationAddress/cac:AddressLine/cbc:Line', invoice.invoice_supplier.address.street)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationAddress/cac:Country/cbc:IdentificationCode', invoice.invoice_supplier.address.country.code)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationAddress/cac:Country/cbc:name', invoice.invoice_supplier.address.country.name)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationAddress/cac:Country/cac:AddressLine/cbc:Line', invoice.invoice_supplier.address.street)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/fe:PhysicalLocation/fe:Address/cac:AddressLine/cbc:Line',
invoice.invoice_supplier.address)
invoice.invoice_supplier.address.street)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/cac:PartyIdentification/cbc:ID',
invoice.invoice_customer.ident)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PartyTaxScheme/cbc:TaxLevelCode',
@ -224,9 +242,14 @@ class DIANInvoiceXML(fe.FeXML):
invoice.invoice_customer.ident)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationName',
invoice.invoice_customer.legal_name)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationAddress/cbc:CityName', invoice.invoice_customer.address.city)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationAddress/cac:Country/cbc:IdentificationCode', invoice.invoice_customer.address.country.code)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationAddress/cac:Country/cbc:Name', invoice.invoice_customer.address.country.name)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationAddress/cac:AddressLine/cbc:Line', invoice.invoice_customer.address.street)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PhysicalLocation/fe:Address/cac:AddressLine/cbc:Line',
invoice.invoice_customer.address)
invoice.invoice_customer.address.street)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationAddress/cac:Country/cac:AddressLine/cbc:Line', invoice.invoice_customer.address.street)
fexml.set_element('/fe:Invoice/fe:LegalMonetaryTotal/cbc:LineExtensionAmount',
invoice.invoice_legal_monetary_total.line_extension_amount,
currencyID='COP')

View File

@ -24,13 +24,15 @@ def simple_invoice_without_lines():
name = 'facho-supplier',
ident = 123,
responsability_code = 'No aplica',
organization_code = 'Persona Natural'
organization_code = 'Persona Natural',
address = form.Address(name='Test Building')
))
inv.set_customer(form.Party(
name = 'facho-customer',
ident = 321,
responsability_code = 'No aplica',
organization_code = 'Persona Natural'
organization_code = 'Persona Natural',
address = form.Address(name='Test Building')
))
return inv