mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-07 21:04:00 +02:00
brmbar-cli.py inventory-interactive: Try to detect mistaken barcode scan
This commit is contained in:
parent
edc99f1ff9
commit
6b67dd372e
1 changed files with 4 additions and 2 deletions
|
@ -182,16 +182,18 @@ elif sys.argv[1] == "inventory-interactive":
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
iacct = brmbar.Account.load_by_barcode(db, barcode)
|
iacct = brmbar.Account.load_by_barcode(db, barcode)
|
||||||
amount = str(input("What is the amount of {} in reality current is {}:".format(iacct.name, iacct.balance())))
|
amount = str(input("What is the amount of {} in reality (expected: {} pcs):".format(iacct.name, iacct.balance())))
|
||||||
if amount == "":
|
if amount == "":
|
||||||
break
|
break
|
||||||
|
elif int(amount) > 10000:
|
||||||
|
print("Ignoring too high amount {}, assuming barcode was mistakenly scanned instead".format(amount))
|
||||||
else:
|
else:
|
||||||
iamt = int(amount)
|
iamt = int(amount)
|
||||||
print("Current state {} (id {}): {} pcs".format(iacct.name, iacct.id, iacct.balance()))
|
print("Current state {} (id {}): {} pcs".format(iacct.name, iacct.id, iacct.balance()))
|
||||||
if shop.fix_inventory(item = iacct, amount = iamt):
|
if shop.fix_inventory(item = iacct, amount = iamt):
|
||||||
print("New state {} (id {}): {} pcs".format(iacct.name, iacct.id, iacct.balance()))
|
print("New state {} (id {}): {} pcs".format(iacct.name, iacct.id, iacct.balance()))
|
||||||
else:
|
else:
|
||||||
print ("No action needed amount is correct.")
|
print("No action needed, amount is correct.")
|
||||||
print("End of processing. Bye")
|
print("End of processing. Bye")
|
||||||
elif sys.argv[1] == "changecash":
|
elif sys.argv[1] == "changecash":
|
||||||
if (len(sys.argv) != 3):
|
if (len(sys.argv) != 3):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue