Add CostFieldRenderer and tweak product view template

latter being for easier customization
This commit is contained in:
Lance Edgar 2017-03-23 20:32:56 -05:00
parent 95b2ce25c1
commit 3dfe3dfa28
4 changed files with 135 additions and 103 deletions

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8; -*-
################################################################################
#
# Rattail -- Retail Software Framework
@ -216,6 +216,14 @@ class ProductsView(MasterView):
g.vendor.set(label="Pref. Vendor")
g.joiners['cost'] = lambda q: q.outerjoin(model.ProductCost,
sa.and_(
model.ProductCost.product_uuid == model.Product.uuid,
model.ProductCost.preference == 1))
g.sorters['cost'] = g.make_sorter(model.ProductCost.unit_cost)
g.filters['cost'] = g.make_filter('cost', model.ProductCost.unit_cost)
g.cost.set(renderer=forms.renderers.CostFieldRenderer)
g.default_sortkey = 'upc'
if self.print_labels and self.request.has_perm('products.print_labels'):