From 5a045ccdefad3cf6868d4e0e64f34cd847dcd3cf Mon Sep 17 00:00:00 2001 From: cosmos Date: Sun, 28 Aug 2022 16:42:54 +0000 Subject: [PATCH] support document updates DSAZ13 DSAZ14 FossilOrigin-Name: 18a1849b96425974b7e53bc236a9484e7c064e960b90844675eb4fe02cf6ad8a --- facho/cli.py | 6 ++-- facho/fe/form/__init__.py | 4 +-- facho/fe/form_xml/support_document.py | 42 +++++++++++++-------------- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/facho/cli.py b/facho/cli.py index 8db2710..9ef1fec 100644 --- a/facho/cli.py +++ b/facho/cli.py @@ -259,14 +259,14 @@ def generate_invoice(private_key, passphrase, scriptname, generate=False, ssl=Tr spec.loader.exec_module(module) import facho.fe.form as form - from facho.fe.form_xml import DIANInvoiceXML, DIANWriteSigned,DIANWrite + from facho.fe.form_xml import DIANInvoiceXML, DIANWriteSigned, DIANWrite, DIANSupportDocumentXML from facho import fe try: invoice_xml = module.document_xml() except AttributeError: - invoice_xml = DIANInvoiceXML - + #invoice_xml = DIANInvoiceXML + invoice_xml = DIANSupportDocumentXML print("Using document xml:", invoice_xml) invoice = module.invoice() invoice.calculate() diff --git a/facho/fe/form/__init__.py b/facho/fe/form/__init__.py index e6838a6..7d4a51c 100644 --- a/facho/fe/form/__init__.py +++ b/facho/fe/form/__init__.py @@ -163,10 +163,10 @@ class Item: class StandardItem(Item): - def __init__(self, id_: str, description: str = ''): + def __init__(self, id_: str, description: str = '', name: str = ''): super().__init__(id=id_, description=description, - scheme_name='', + scheme_name=name, scheme_id='999', scheme_agency_id='') diff --git a/facho/fe/form_xml/support_document.py b/facho/fe/form_xml/support_document.py index ae0aba2..a2fbcfb 100644 --- a/facho/fe/form_xml/support_document.py +++ b/facho/fe/form_xml/support_document.py @@ -3,9 +3,9 @@ from ..form import * from datetime import datetime, date from .attached_document import * -__all__ = ['DIANInvoiceSupportDocumentXML'] +__all__ = ['DIANSupportDocumentXML'] -class DIANInvoiceSupportDocumentXML(fe.FeXML): +class DIANSupportDocumentXML(fe.FeXML): """ DianSupportDocumentXML mapea objeto form.Invoice a XML segun lo indicado para él Documento soporte en adquisiciones efectuadas con sujetos no obligados a expedir factura de venta o documento equivalente. @@ -293,25 +293,25 @@ class DIANInvoiceSupportDocumentXML(fe.FeXML): if isinstance(reference, InvoiceDocumentReference): return fexml._set_invoice_document_reference(reference) - def set_discrepancy_response(fexml, invoice): - reference = invoice.invoice_discrepancy_response - if reference is None: - return + # def set_discrepancy_response(fexml, invoice): + # reference = invoice.invoice_discrepancy_response + # if reference is None: + # return - if isinstance(reference, DebitNoteDocumentReference): - return fexml._set_debit_note_document_reference(reference) - if isinstance(reference, CreditNoteDocumentReference): - return fexml._set_credit_note_document_reference(reference) + # if isinstance(reference, DebitNoteDocumentReference): + # return fexml._set_debit_note_document_reference(reference) + # if isinstance(reference, CreditNoteDocumentReference): + # return fexml._set_credit_note_document_reference(reference) - if isinstance(reference, InvoiceDocumentReference): - return fexml._set_invoice_document_reference(reference) + # if isinstance(reference, InvoiceDocumentReference): + # return fexml._set_invoice_document_reference(reference) - fexml.set_element('./cac:DiscrepancyResponse/cbc:ReferenceID', - reference.ident) - fexml.set_element('./cac:DiscrepancyResponse/cbc:ResponseCode:UUID', - '1') - fexml.set_element('./cac:DiscrepancyResponse/cbc:Description', - 'Test') + # fexml.set_element('./cac:DiscrepancyResponse/cbc:ReferenceID', + # reference.ident) + # fexml.set_element('./cac:DiscrepancyResponse/cbc:ResponseCode:UUID', + # '1') + # fexml.set_element('./cac:DiscrepancyResponse/cbc:Description', + # 'Test') def set_invoice_totals(fexml, invoice): tax_amount_for = defaultdict(lambda: defaultdict(lambda: Amount(0.0))) @@ -496,11 +496,9 @@ class DIANInvoiceSupportDocumentXML(fe.FeXML): fexml.set_invoice_lines(invoice) fexml.set_payment_mean(invoice) fexml.set_allowance_charge(invoice) - fexml.set_discrepancy_response(invoice) + #fexml.set_discrepancy_response(invoice) fexml.set_billing_reference(invoice) - cosa = AttachedDocument(id=1, xml=fexml) - print(cosa.toFachoXML()) - + return fexml def customize(fexml, invoice):