facho/fe/form(Invoice): se separa prefix y consecutivo.
* facho/fe/form(Invoice.set_ident_prefix): nuevo metodo para asignacion manual del prefijo, por defecto se obtiene de **ident**. FossilOrigin-Name: 998d3315e15c83626d55bb8f3f2c2d16bf4c1c4a8ea172350254acfeb4ce6e4e
This commit is contained in:
parent
4339fd7403
commit
c44a49fccb
@ -508,7 +508,7 @@ class Invoice:
|
|||||||
self.invoice_prepaid_payment = []
|
self.invoice_prepaid_payment = []
|
||||||
self.invoice_billing_reference = None
|
self.invoice_billing_reference = None
|
||||||
self.invoice_type_code = str(type_code)
|
self.invoice_type_code = str(type_code)
|
||||||
|
self.invoice_ident_prefix = None
|
||||||
|
|
||||||
def set_period(self, startdate, enddate):
|
def set_period(self, startdate, enddate):
|
||||||
self.invoice_period_start = startdate
|
self.invoice_period_start = startdate
|
||||||
@ -521,7 +521,20 @@ class Invoice:
|
|||||||
self.invoice_issue = dtime
|
self.invoice_issue = dtime
|
||||||
|
|
||||||
def set_ident(self, ident: str):
|
def set_ident(self, ident: str):
|
||||||
|
"""
|
||||||
|
identificador de factura; prefijo + consecutivo
|
||||||
|
"""
|
||||||
self.invoice_ident = ident
|
self.invoice_ident = ident
|
||||||
|
if not self.invoice_ident_prefix:
|
||||||
|
self.invoice_ident_prefix = ident[0:4]
|
||||||
|
|
||||||
|
def set_ident_prefix(self, prefix: str):
|
||||||
|
"""
|
||||||
|
prefijo de facturacion: ejemplo SETP
|
||||||
|
"""
|
||||||
|
if len(prefix) != 4:
|
||||||
|
raise ValueError('prefix must be 4 length')
|
||||||
|
self.invoice_ident_prefix = prefix
|
||||||
|
|
||||||
def set_supplier(self, party: Party):
|
def set_supplier(self, party: Party):
|
||||||
self.invoice_supplier = party
|
self.invoice_supplier = party
|
||||||
|
@ -174,7 +174,7 @@ class DIANInvoiceXML(fe.FeXML):
|
|||||||
#DIAN 1.7.-2020: FAJ50
|
#DIAN 1.7.-2020: FAJ50
|
||||||
#DIAN 1.7.-2020: CAJ50
|
#DIAN 1.7.-2020: CAJ50
|
||||||
fexml.set_element('./cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cac:CorporateRegistrationScheme/cbc:ID',
|
fexml.set_element('./cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cac:CorporateRegistrationScheme/cbc:ID',
|
||||||
'SETP')
|
invoice.invoice_ident_prefix)
|
||||||
|
|
||||||
#DIAN 1.7.-2020: CAJ67
|
#DIAN 1.7.-2020: CAJ67
|
||||||
fexml.placeholder_for('./cac:AccountingSupplierParty/cac:Party/cac:Contact')
|
fexml.placeholder_for('./cac:AccountingSupplierParty/cac:Party/cac:Contact')
|
||||||
|
@ -174,3 +174,13 @@ def test_invoice_legalmonetary_with_taxes():
|
|||||||
assert inv.invoice_legal_monetary_total.charge_total_amount == form.Amount(0.0)
|
assert inv.invoice_legal_monetary_total.charge_total_amount == form.Amount(0.0)
|
||||||
assert inv.invoice_legal_monetary_total.payable_amount == form.Amount(100.0)
|
assert inv.invoice_legal_monetary_total.payable_amount == form.Amount(100.0)
|
||||||
|
|
||||||
|
def test_invoice_ident_prefix_automatic():
|
||||||
|
inv = form.NationalSalesInvoice()
|
||||||
|
inv.set_ident('SETP1234567')
|
||||||
|
assert inv.invoice_ident_prefix == 'SETP'
|
||||||
|
|
||||||
|
def test_invoice_ident_prefix_manual():
|
||||||
|
inv = form.NationalSalesInvoice()
|
||||||
|
inv.set_ident('SETP1234567')
|
||||||
|
inv.set_ident_prefix('SETA')
|
||||||
|
assert inv.invoice_ident_prefix == 'SETA'
|
||||||
|
Loading…
Reference in New Issue
Block a user