From b33c2fd0d0237313c1d8f082cf450a005bce01ef Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 14 Nov 2018 10:33:39 -0600 Subject: [PATCH] Add simple price fields for product XLSX results download --- tailbone/views/products.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tailbone/views/products.py b/tailbone/views/products.py index c5ea6de7..a8ba6447 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -507,6 +507,15 @@ class ProductsView(MasterView): i = fields.index('brand_uuid') fields.insert(i + 1, 'brand_name') + i = fields.index('suggested_price_uuid') + fields.insert(i + 1, 'suggested_price') + + i = fields.index('regular_price_uuid') + fields.insert(i + 1, 'regular_price') + + i = fields.index('current_price_uuid') + fields.insert(i + 1, 'current_price') + return fields def get_xlsx_row(self, product, fields): @@ -539,6 +548,15 @@ class ProductsView(MasterView): if 'brand_name' in fields: row['brand_name'] = product.brand.name if product.brand else None + if 'suggested_price' in fields: + row['suggested_price'] = product.suggested_price.price if product.suggested_price else None + + if 'regular_price' in fields: + row['regular_price'] = product.regular_price.price if product.regular_price else None + + if 'current_price' in fields: + row['current_price'] = product.current_price.price if product.current_price else None + return row def get_instance(self):