From 132b2b9ec792f4f60a92d19ec94f78b5414ae86d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 28 Jan 2020 16:33:23 -0600 Subject: [PATCH] Fix vendor ID/name for Excel download of pricing batch rows --- tailbone/views/batch/pricing.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tailbone/views/batch/pricing.py b/tailbone/views/batch/pricing.py index be870fbc..996cbb2b 100644 --- a/tailbone/views/batch/pricing.py +++ b/tailbone/views/batch/pricing.py @@ -261,6 +261,7 @@ class PricingBatchView(BatchMasterView): return fields + # TODO: this is the same as xlsx row! should merge/share somehow? def get_row_csv_row(self, row, fields): csvrow = super(PricingBatchView, self).get_row_csv_row(row, fields) @@ -274,6 +275,20 @@ class PricingBatchView(BatchMasterView): return csvrow + # TODO: this is the same as csv row! should merge/share somehow? + def get_row_xlsx_row(self, row, fields): + xlrow = super(PricingBatchView, self).get_row_xlsx_row(row, fields) + + vendor = row.vendor + if 'vendor_id' in fields: + xlrow['vendor_id'] = (vendor.id or '') if vendor else '' + if 'vendor_abbreviation' in fields: + xlrow['vendor_abbreviation'] = (vendor.abbreviation or '') if vendor else '' + if 'vendor_name' in fields: + xlrow['vendor_name'] = (vendor.name or '') if vendor else '' + + return xlrow + def includeme(config): PricingBatchView.defaults(config)