Add some vendor fields for product Excel download

This commit is contained in:
Lance Edgar 2019-06-13 10:00:29 -05:00
parent f727c87b56
commit 33e1bd567d

View file

@ -556,6 +556,10 @@ class ProductsView(MasterView):
i = fields.index('current_price_uuid')
fields.insert(i + 1, 'current_price')
fields.append('vendor_uuid')
fields.append('vendor_id')
fields.append('vendor_name')
fields.append('vendor_item_code')
fields.append('unit_cost')
return fields
@ -603,6 +607,18 @@ class ProductsView(MasterView):
if 'current_price' in fields:
row['current_price'] = product.current_price.price if product.current_price else None
if 'vendor_uuid' in fields:
row['vendor_uuid'] = product.cost.vendor.uuid if product.cost else None
if 'vendor_id' in fields:
row['vendor_id'] = product.cost.vendor.id if product.cost else None
if 'vendor_name' in fields:
row['vendor_name'] = product.cost.vendor.name if product.cost else None
if 'vendor_item_code' in fields:
row['vendor_item_code'] = product.cost.code if product.cost else None
if 'unit_cost' in fields:
row['unit_cost'] = product.cost.unit_cost if product.cost else None