minor bug

This commit is contained in:
Sugiarto 2024-02-05 05:28:15 +07:00
parent f3b54e8d76
commit 6c7a48c5cc
2 changed files with 14 additions and 8 deletions

View File

@ -145,18 +145,24 @@ def QBStock(client_socket=None, filename='', searchitems = None):
itemInvDict={} itemInvDict={}
for ItemInvRet in ItemInventoryQueryRs: for ItemInvRet in ItemInventoryQueryRs:
try: try:
# QOH = ItemInvRet.find('QuantityOnHand').text
QOH = ItemInvRet.find('QuantityOnHand').text QOH = ItemInvRet.find('QuantityOnHand').text
QOSO = ItemInvRet.find('QuantityOnSalesOrder').text QOSO = ItemInvRet.find('QuantityOnSalesOrder')
if QOSO != None:
QOSO = QOSO.text
else:
QOSO = 0
#txnid = ItemInvRet.find('ListID').text #txnid = ItemInvRet.find('ListID').text
name = ItemInvRet.find('Name').text name = ItemInvRet.find('Name').text
fullName = ItemInvRet.find('FullName').text fullName = ItemInvRet.find('FullName').text
# print(name, fullName)
itemInvDict[fullName] = [name, int(QOH) - int(QOSO)] itemInvDict[fullName] = [name, int(QOH) - int(QOSO)]
print(itemInvDict[name], name, QOH, QOSO) print(itemInvDict[fullName], name, QOH, QOSO)
except AttributeError: except AttributeError as e:
pass pass
print(" Attribute err") print(" Attribute err:", e)
except: except Exception as e:
print("err") print("err:", e)
checkItemReportQuery(itemInvDict) checkItemReportQuery(itemInvDict)
return itemInvDict return itemInvDict

View File

@ -147,11 +147,11 @@ def QBStock(client_socket=None, filename='', searchitems = None):
#print("") #print("")
response_string = sessionManager.ProcessRequest(ticket, qbxml_query1) response_string = sessionManager.ProcessRequest(ticket, qbxml_query1)
print (f"itemreportquery.py -> {response_string}") # print (f"itemreportquery.py response -> {response_string}")
# Disconnect from Quickbooks # Disconnect from Quickbooks
sessionManager.EndSession(ticket) # Close the company file sessionManager.EndSession(ticket) # Close the company file
sessionManager.CloseConnection() # Close the connection sessionManager.CloseConnection() # Close the connection
print (f"itemreportquery.py -> {response_string}") print (f"itemreportquery.py response -> {response_string}")
# Parse the response into an Element Tree and peel away the layers of response # Parse the response into an Element Tree and peel away the layers of response
#QBXML = xml.etree.ElementTree.fromstring(response_string) #QBXML = xml.etree.ElementTree.fromstring(response_string)