diff --git a/SO_to_Inv/readSO.py b/SO_to_Inv/readSO.py index 5db9aa6..c76c9d3 100644 --- a/SO_to_Inv/readSO.py +++ b/SO_to_Inv/readSO.py @@ -198,7 +198,6 @@ class SalesOrderQuery: # if soidx == len(self.SalesOrderList)-1: #last list then set the'400_Sales_discount' # print(f'disc_amount:{format(disc_amount, ".2f")}') # if disc_amount != 0: - # # disc_amount=format(disc_amount, ".2f") # InvoiceLineAdd = self.create_sub_element(ET, InvoiceAdd, "InvoiceLineAdd", "\n ", 10 ) # ItemRef = self.create_sub_element(ET, InvoiceLineAdd, "ItemRef", "\n ", 12) @@ -219,7 +218,16 @@ class SalesOrderQuery: qbxml_query = qbxml_query + "\n" + mydata # print(f'create_invoiceadd_QBXML->Create_Invoiceadd_QBXML: {qbxml_query}') # print(f"replyfrom qbxml:{self.connect_to_quickbooks(qbxml_query)}") + # print([s for s in qbxml_query.split('\n') if s.strip(' ') != '']) + import xml.dom.minidom + # dom = xml.dom.minidom.parse(xml_fname) # or + dom = xml.dom.minidom.parseString(qbxml_query) + pretty_xml_as_string = dom.toprettyxml(" ").split('\n') + # pretty_xml_as_string = '\n'.join([s for s in pretty_xml_as_string if s.strip(' ') != ""]) + pretty_xml_as_string = '\n'.join([s for s in pretty_xml_as_string if s.strip() ]) + + print(pretty_xml_as_string) return qbxml_query diff --git a/django/Invoice/views.py b/django/Invoice/views.py index 5ec6ea3..57c9e65 100644 --- a/django/Invoice/views.py +++ b/django/Invoice/views.py @@ -105,7 +105,7 @@ def show_inv(request): if itu: invoiceaddQBXML=ini.create_invoiceadd_QBXML() print(invoiceaddQBXML) - print(ini.connect_to_quickbooks(ini.create_invoiceadd_QBXML())) + # print(ini.connect_to_quickbooks(ini.create_invoiceadd_QBXML())) return render( request, "Invoice/so_list_form.html", context) # return HttpResponse('')