forked from brmlab/brmbar-github
Fixes after tests
This commit is contained in:
parent
0706054e81
commit
7ac0031a8d
2 changed files with 9 additions and 4 deletions
|
@ -152,8 +152,9 @@ elif sys.argv[1] == "inventory":
|
|||
iamt = int(sys.argv[2])
|
||||
iacct = load_item(sys.argv[3]) #TODO:use barcodes later
|
||||
print("Current state {} (id {}): {} pcs".format(iacct.name, iacct.id, iacct.balance()))
|
||||
shop.fix_inventory(item = iacct, amount = iamt)
|
||||
print("New state {} (id {}): {} pcs".format(iacct.name, iacct.id, iacct.balance()))
|
||||
|
||||
if shop.fix_inventory(item = iacct, amount = iamt):
|
||||
print("New state {} (id {}): {} pcs".format(iacct.name, iacct.id, iacct.balance()))
|
||||
else:
|
||||
print ("No action needed amount is correct.")
|
||||
else:
|
||||
help()
|
||||
|
|
|
@ -156,8 +156,12 @@ class Shop:
|
|||
item.debit(transaction, diff, "Inventory fix excess")
|
||||
self.excess.credit(transaction, buy_total, "Inventory fix excess " + item.name)
|
||||
self.db.commit()
|
||||
return True
|
||||
elif amount_in_reality < amount_in_system:
|
||||
transaction = self._transaction(description = "BrmBar inventory fix of {}pcs {} in system to {}pcs in reality".format(amount_in_system, item.name,amount_in_reality))
|
||||
item.credit(transaction, diff, "Inventory fix deficit")
|
||||
self.deficit.credit(transaction, buy_total, "Inventory fix deficit " + item.name)
|
||||
self.deficit.debit(transaction, buy_total, "Inventory fix deficit " + item.name)
|
||||
self.db.commit()
|
||||
return True
|
||||
else:
|
||||
return False
|
Loading…
Add table
Add a link
Reference in a new issue