Compare commits

...

2 Commits

View File

@@ -307,11 +307,12 @@ def checkout(user, barcode, loc=None):
loc = None loc = None
if itm: if itm:
itm.checkout = True itm.checkout = True
itm.checkout_user = user if user is not False:
itm.checkout_user = user
itm.checkout_loc = loc itm.checkout_loc = loc
itm.save() itm.save()
itmdict = item.select().where(item.barcode==itm.barcode).dicts()[0] itmdict = item.select().where(item.barcode==itm.barcode).dicts()[0]
itmdict["location"] = fancy_location(item.select().where(item.barcode==itm["barcode"])[0].loc) itmdict["location"] = fancy_location(item.select().where(item.barcode==itmdict["barcode"])[0].loc)
search.add_document(itmdict) search.add_document(itmdict)
return itm return itm
else: else:
@@ -324,12 +325,13 @@ def checkin(user, barcode, loc=None):
if itm: if itm:
print("Found", itm.fullname) print("Found", itm.fullname)
itm.checkout = False itm.checkout = False
itm.last_user = user if user is not False:
itm.last_user = user
if loc is not None: if loc is not None:
itm.loc = loc itm.loc = loc
itm.save() itm.save()
itmdict = item.select().where(item.barcode==itm.barcode).dicts()[0] itmdict = item.select().where(item.barcode==itm.barcode).dicts()[0]
itmdict["location"] = fancy_location(item.select().where(item.barcode==itm["barcode"])[0].loc) itmdict["location"] = fancy_location(item.select().where(item.barcode==itmdict["barcode"])[0].loc)
search.add_document(itmdict) search.add_document(itmdict)
return itm return itm
else: else: