Removes hidden status from items if they are added to stock in the normal way

This commit is contained in:
robertem 2017-02-04 23:54:45 +00:00
parent 11593a71d0
commit b3536c19f6
1 changed files with 5 additions and 1 deletions

View File

@ -1403,9 +1403,13 @@ much money you're due in credits for the purchase when prompted.
for product in self.products: for product in self.products:
value = max(product.stock, 0)*product.price + self.products[product][1] value = max(product.stock, 0)*product.price + self.products[product][1]
old_price = product.price old_price = product.price
old_hidden = product.hidden
product.price = int(ceil(float(value)/(max(product.stock, 0) + self.products[product][0]))) product.price = int(ceil(float(value)/(max(product.stock, 0) + self.products[product][0])))
product.stock += self.products[product][0] product.stock += self.products[product][0]
print "New stock for %s: %d" % (product.name, product.stock), ("- New price: " + str(product.price) if old_price != product.price else "") product.hidden = False
print "New stock for %s: %d" % (product.name, product.stock), \
("- New price: " + str(product.price) if old_price != product.price else ""),\
("- Removed hidden status" if old_hidden != product.hidden else "")
try: try:
self.session.commit() self.session.commit()
print "Success! Transaction performed:" print "Success! Transaction performed:"