Fix order xlsx download if missing order date

This commit is contained in:
Lance Edgar 2023-10-17 15:26:22 -05:00
parent 7525aaaa87
commit f86cc83996

View file

@ -460,7 +460,8 @@ class OrderingBatchView(PurchasingBatchView):
worksheet = workbook.active
worksheet.title = "Purchase Order"
worksheet.append(["Store", "Vendor", "Date ordered"])
worksheet.append([batch.store.name, batch.vendor.name, batch.date_ordered.strftime('%m/%d/%Y')])
date_ordered = batch.date_ordered.strftime('%m/%d/%Y') if batch.date_ordered else None
worksheet.append([batch.store.name, batch.vendor.name, date_ordered])
worksheet.append([])
worksheet.append(['vendor_code', 'upc', 'brand_name', 'description', 'cases_ordered', 'units_ordered'])
for row in batch.active_rows():