mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 05:14:00 +02:00
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])
|
iamt = int(sys.argv[2])
|
||||||
iacct = load_item(sys.argv[3]) #TODO:use barcodes later
|
iacct = load_item(sys.argv[3]) #TODO:use barcodes later
|
||||||
print("Current state {} (id {}): {} pcs".format(iacct.name, iacct.id, iacct.balance()))
|
print("Current state {} (id {}): {} pcs".format(iacct.name, iacct.id, iacct.balance()))
|
||||||
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:
|
||||||
|
print ("No action needed amount is correct.")
|
||||||
else:
|
else:
|
||||||
help()
|
help()
|
||||||
|
|
|
@ -156,8 +156,12 @@ class Shop:
|
||||||
item.debit(transaction, diff, "Inventory fix excess")
|
item.debit(transaction, diff, "Inventory fix excess")
|
||||||
self.excess.credit(transaction, buy_total, "Inventory fix excess " + item.name)
|
self.excess.credit(transaction, buy_total, "Inventory fix excess " + item.name)
|
||||||
self.db.commit()
|
self.db.commit()
|
||||||
|
return True
|
||||||
elif amount_in_reality < amount_in_system:
|
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))
|
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")
|
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()
|
self.db.commit()
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
Loading…
Add table
Add a link
Reference in a new issue