Detect non-numeric entry when locating row for purchase batch

i.e. don't try to convert to GPC if non-numeric
This commit is contained in:
Lance Edgar 2018-11-07 13:08:59 -06:00
parent 23a94ebfad
commit 9daefed9b3

View file

@ -1077,6 +1077,8 @@ class ReceivingBatchView(PurchasingBatchView):
key = self.rattail_config.product_key() key = self.rattail_config.product_key()
if key == 'upc': if key == 'upc':
if entry.isdigit():
# we prefer "exact" UPC matches, i.e. those which assumed the entry # we prefer "exact" UPC matches, i.e. those which assumed the entry
# already contained the check digit. # already contained the check digit.
provided = GPC(entry, calc_check_digit=False) provided = GPC(entry, calc_check_digit=False)
@ -1162,6 +1164,9 @@ class ReceivingBatchView(PurchasingBatchView):
if len(entry) > 14: if len(entry) > 14:
return return
if not entry.isdigit():
return
provided = GPC(entry, calc_check_digit=False) provided = GPC(entry, calc_check_digit=False)
checked = GPC(entry, calc_check_digit='upc') checked = GPC(entry, calc_check_digit='upc')