Add simple price fields for product XLSX results download

This commit is contained in:
Lance Edgar 2018-11-14 10:33:39 -06:00
parent a9b60b3d4a
commit b33c2fd0d0

View file

@ -507,6 +507,15 @@ class ProductsView(MasterView):
i = fields.index('brand_uuid') i = fields.index('brand_uuid')
fields.insert(i + 1, 'brand_name') 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 return fields
def get_xlsx_row(self, product, fields): def get_xlsx_row(self, product, fields):
@ -539,6 +548,15 @@ class ProductsView(MasterView):
if 'brand_name' in fields: if 'brand_name' in fields:
row['brand_name'] = product.brand.name if product.brand else None 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 return row
def get_instance(self): def get_instance(self):