Leverage alternate code also, for mobile product quick lookup

This commit is contained in:
Lance Edgar 2018-09-21 19:58:08 -05:00
parent 99688c1c77
commit 255485296c

View file

@ -776,12 +776,14 @@ class ProductsView(MasterView):
return self.render_to_response('index', context, mobile=True)
def mobile_quick_lookup(self):
entry = self.request.POST['quick_entry']
entry = self.request.POST['quick_entry'].strip()
provided = GPC(entry, calc_check_digit=False)
product = api.get_product_by_upc(self.Session(), provided)
if not product:
checked = GPC(entry, calc_check_digit='upc')
product = api.get_product_by_upc(self.Session(), checked)
if not product:
product = api.get_product_by_code(self.Session(), entry)
if not product:
raise self.notfound()
return self.redirect(self.get_action_url('view', product, mobile=True))