Add 'unit_cost' to Excel download for Products grid

This commit is contained in:
Lance Edgar 2018-12-18 16:37:40 -06:00
parent c7496d7018
commit 8d534691ac

View file

@ -518,6 +518,8 @@ class ProductsView(MasterView):
i = fields.index('current_price_uuid')
fields.insert(i + 1, 'current_price')
fields.append('unit_cost')
return fields
def get_xlsx_row(self, product, fields):
@ -563,6 +565,9 @@ class ProductsView(MasterView):
if 'current_price' in fields:
row['current_price'] = product.current_price.price if product.current_price else None
if 'unit_cost' in fields:
row['unit_cost'] = product.cost.unit_cost if product.cost else None
return row
def get_instance(self):