Don't add values to CSV row for undefined fields

This commit is contained in:
Lance Edgar 2018-11-18 20:02:14 -06:00
parent de6275003e
commit fded97d586

View file

@ -184,9 +184,12 @@ class PricingBatchView(BatchMasterView):
csvrow = super(PricingBatchView, self).get_row_csv_row(row, fields) csvrow = super(PricingBatchView, self).get_row_csv_row(row, fields)
vendor = row.vendor vendor = row.vendor
csvrow['vendor_id'] = vendor.id if vendor else None if 'vendor_id' in fields:
csvrow['vendor_abbreviation'] = vendor.abbreviation if vendor else None csvrow['vendor_id'] = vendor.id if vendor else None
csvrow['vendor_name'] = vendor.name if vendor else None if 'vendor_abbreviation' in fields:
csvrow['vendor_abbreviation'] = vendor.abbreviation if vendor else None
if 'vendor_name' in fields:
csvrow['vendor_name'] = vendor.name if vendor else None
return csvrow return csvrow