Fix bug in KeHe invoice parser, if row has no UPC.

This commit is contained in:
Lance Edgar 2015-07-15 20:59:41 -05:00
parent f420d1fdd9
commit 8d37cff1f1

View file

@ -74,7 +74,8 @@ class KeheCatalogParser(CatalogParser):
for r in range(1, sheet.nrows): # Skip first header row.
row = VendorCatalogRow()
row.upc = GPC(int(sheet.cell_value(r, 5)))
upc = sheet.cell_value(r, 5) or None
row.upc = GPC(int(upc)) if upc else None
row.brand_name = sheet.cell_value(r, 1)
row.description = sheet.cell_value(r, 2)
row.size = sheet.cell_value(r, 3)
@ -89,6 +90,7 @@ class KeheCatalogParser(CatalogParser):
# use the "Case Pack" column in that case.
case_pack = int(sheet.cell_value(r, 6))
unit_of_sales = int(sheet.cell_value(r, 7))
if row.upc:
product = products.get(row.upc)
if product: