Improve display of VendorItem records when viewing a CORE Product

This commit is contained in:
Lance Edgar 2021-01-30 13:18:32 -06:00
parent b14e4b09fc
commit bd1be88be4

View file

@ -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