diff --git a/facho/fe/form.py b/facho/fe/form.py index 4b06b47..6c9fc53 100644 --- a/facho/fe/form.py +++ b/facho/fe/form.py @@ -185,6 +185,10 @@ class DIANInvoiceXML(fe.FeXML): invoice.calculate() + fexml.set_element('/fe:Invoice/cbc:InvoiceTypeCode', codelist.TipoDocumento['Factura de Venta Nacional']['code'], + listAgencyID='195', + listAgencyName='No matching global declaration available for the validation root', + listURI='http://www.dian.gov.co') fexml.set_element('/fe:Invoice/cbc:UBLVersionID', 'UBL 2.1') fexml.set_element('/fe:Invoice/cbc:ID', invoice.invoice_ident) fexml.set_element('/fe:Invoice/cbc:IssueDate', invoice.invoice_issue.strftime('%Y-%m-%d')) diff --git a/tests/test_fe_form.py b/tests/test_fe_form.py index b538081..e20fb30 100644 --- a/tests/test_fe_form.py +++ b/tests/test_fe_form.py @@ -143,6 +143,11 @@ def test_invoice_profileexecutionid(simple_invoice): id_ = xml_invoice.get_element_text('/fe:Invoice/cbc:ProfileExecutionID', format_=int) assert id_ == 2 +def test_invoice_invoice_type_code(simple_invoice): + xml_invoice = form.DIANInvoiceXML(simple_invoice) + id_ = xml_invoice.get_element_text('/fe:Invoice/cbc:InvoiceTypeCode', format_=int) + assert id_ == 1 + def test_invoice_totals(simple_invoice_without_lines): simple_invoice = simple_invoice_without_lines simple_invoice.invoice_ident = '323200000129'