From bd1be88be438bfaf83485f1af3760202cc9b82b0 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 30 Jan 2021 13:18:32 -0600 Subject: [PATCH] Improve display of VendorItem records when viewing a CORE Product --- tailbone_corepos/views/corepos/products.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/tailbone_corepos/views/corepos/products.py b/tailbone_corepos/views/corepos/products.py index f89af32..0984883 100644 --- a/tailbone_corepos/views/corepos/products.py +++ b/tailbone_corepos/views/corepos/products.py @@ -227,20 +227,16 @@ class ProductView(CoreOfficeMasterView): key='{}.vendor_items'.format(route_prefix), data=[], columns=[ - 'vendor_item_id', - 'sku', 'vendor_name', - 'upc', - 'brand', - 'description', + 'sku', 'size', + 'cost_display', 'units', ], labels={ - 'vendor_item_id': "ID", 'sku': "SKU", 'vendor_name': "Vendor", - 'upc': "UPC", + 'cost_display': "Cost", }, ) return HTML.literal( @@ -249,24 +245,16 @@ class ProductView(CoreOfficeMasterView): def template_kwargs_view(self, **kwargs): kwargs = super(ProductView, self).template_kwargs_view(**kwargs) product = kwargs['instance'] + app = self.get_rattail_app() vendor_items = [] for item in product.vendor_items: vendor_items.append({ - 'vendor_item_id': item.vendor_item_id, 'sku': item.sku, - 'vendor_id': item.vendor_id, 'vendor_name': item.vendor.name, - 'upc': item.upc, - 'brand': item.brand, - 'description': item.description, 'size': item.size, + 'cost_display': app.render_currency(item.cost), 'units': item.units, - # 'cost': item.cost, - # 'sale_cost': item.sale_cost, - 'vendor_department_id': item.vendor_department_id, - # 'srp': item.srp, - # 'modified': item.modified, }) kwargs['vendor_items_data'] = vendor_items