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={}
for ItemInvRet in ItemInventoryQueryRs:
try:
# 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
name = ItemInvRet.find('Name').text
fullName = ItemInvRet.find('FullName').text
# print(name, fullName)
itemInvDict[fullName] = [name, int(QOH) - int(QOSO)]
print(itemInvDict[name], name, QOH, QOSO)
except AttributeError:
print(itemInvDict[fullName], name, QOH, QOSO)
except AttributeError as e:
pass
print(" Attribute err")
except:
print("err")
print(" Attribute err:", e)
except Exception as e:
print("err:", e)
checkItemReportQuery(itemInvDict)
return itemInvDict

View File

@ -147,11 +147,11 @@ def QBStock(client_socket=None, filename='', searchitems = None):
#print("")
response_string = sessionManager.ProcessRequest(ticket, qbxml_query1)
print (f"itemreportquery.py -> {response_string}")
# print (f"itemreportquery.py response -> {response_string}")
# Disconnect from Quickbooks
sessionManager.EndSession(ticket) # Close the company file
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
#QBXML = xml.etree.ElementTree.fromstring(response_string)