Allow location name lookup, fix search typo
This commit is contained in:
@@ -307,11 +307,12 @@ def checkout(user, barcode, loc=None):
|
||||
loc = None
|
||||
if itm:
|
||||
itm.checkout = True
|
||||
itm.checkout_user = user
|
||||
if user is not False:
|
||||
itm.checkout_user = user
|
||||
itm.checkout_loc = loc
|
||||
itm.save()
|
||||
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)
|
||||
return itm
|
||||
else:
|
||||
@@ -324,12 +325,13 @@ def checkin(user, barcode, loc=None):
|
||||
if itm:
|
||||
print("Found", itm.fullname)
|
||||
itm.checkout = False
|
||||
itm.last_user = user
|
||||
if user is not False:
|
||||
itm.last_user = user
|
||||
if loc is not None:
|
||||
itm.loc = loc
|
||||
itm.save()
|
||||
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)
|
||||
return itm
|
||||
else:
|
||||
@@ -382,6 +384,8 @@ def get_location_id(barcode):
|
||||
#print(loc.name, loc.locationid)
|
||||
if loc.locationid == barcode:
|
||||
return loc
|
||||
elif loc.name == barcode:
|
||||
return loc
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user