From 33e1bd567dff7994af8098bb11aab50a8d632954 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 13 Jun 2019 10:00:29 -0500 Subject: [PATCH] Add some vendor fields for product Excel download --- tailbone/views/products.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tailbone/views/products.py b/tailbone/views/products.py index e15154cd..a670bbbd 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -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