diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index b5332f2d..8c935587 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -1077,20 +1077,22 @@ class ReceivingBatchView(PurchasingBatchView): key = self.rattail_config.product_key() if key == 'upc': - # we prefer "exact" UPC matches, i.e. those which assumed the entry - # already contained the check digit. - provided = GPC(entry, calc_check_digit=False) - rows = [row for row in batch.active_rows() - if row.upc == provided] - if rows: - return rows + if entry.isdigit(): - # if no "exact" UPC matches, we'll settle for those (UPC matches) - # which assume the entry lacked a check digit. - checked = GPC(entry, calc_check_digit='upc') - rows = [row for row in batch.active_rows() - if row.upc == checked] - return rows + # we prefer "exact" UPC matches, i.e. those which assumed the entry + # already contained the check digit. + provided = GPC(entry, calc_check_digit=False) + rows = [row for row in batch.active_rows() + if row.upc == provided] + if rows: + return rows + + # if no "exact" UPC matches, we'll settle for those (UPC matches) + # which assume the entry lacked a check digit. + checked = GPC(entry, calc_check_digit='upc') + rows = [row for row in batch.active_rows() + if row.upc == checked] + return rows elif key == 'item_id': rows = [row for row in batch.active_rows() @@ -1162,6 +1164,9 @@ class ReceivingBatchView(PurchasingBatchView): if len(entry) > 14: return + if not entry.isdigit(): + return + provided = GPC(entry, calc_check_digit=False) checked = GPC(entry, calc_check_digit='upc')