Show "unit cost" column by default, for products grid
This commit is contained in:
parent
62d1918892
commit
37de777b2a
|
@ -86,6 +86,7 @@ class ProductsView(MasterView):
|
|||
'size',
|
||||
'subdepartment',
|
||||
'vendor',
|
||||
'cost',
|
||||
'regular_price',
|
||||
'current_price',
|
||||
]
|
||||
|
@ -239,13 +240,6 @@ class ProductsView(MasterView):
|
|||
g.filters['vendor_code'] = g.make_filter('vendor_code', ProductCostCode.code)
|
||||
g.filters['vendor_code_any'] = g.make_filter('vendor_code_any', ProductCostCodeAny.code)
|
||||
|
||||
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.set_label('regular_price', "Reg. Price")
|
||||
g.set_joiner('regular_price', lambda q: q.outerjoin(
|
||||
self.RegularPrice, self.RegularPrice.uuid == model.Product.regular_price_uuid))
|
||||
|
@ -258,6 +252,16 @@ class ProductsView(MasterView):
|
|||
g.set_sorter('current_price', self.CurrentPrice.price)
|
||||
g.set_filter('current_price', self.CurrentPrice.price, label="Current Price")
|
||||
|
||||
# (unit) cost
|
||||
g.set_joiner('cost', lambda q: q.outerjoin(model.ProductCost,
|
||||
sa.and_(
|
||||
model.ProductCost.product_uuid == model.Product.uuid,
|
||||
model.ProductCost.preference == 1)))
|
||||
g.set_sorter('cost', model.ProductCost.unit_cost)
|
||||
g.set_filter('cost', model.ProductCost.unit_cost)
|
||||
g.set_renderer('cost', self.render_cost)
|
||||
g.set_label('cost', "Unit Cost")
|
||||
|
||||
# report_code_name
|
||||
g.set_joiner('report_code_name', lambda q: q.outerjoin(model.ReportCode))
|
||||
g.set_filter('report_code_name', model.ReportCode.name)
|
||||
|
@ -271,7 +275,6 @@ class ProductsView(MasterView):
|
|||
|
||||
g.set_renderer('regular_price', self.render_price)
|
||||
g.set_renderer('current_price', self.render_price)
|
||||
g.set_renderer('cost', self.render_cost)
|
||||
g.set_renderer('on_hand', self.render_on_hand)
|
||||
g.set_renderer('on_order', self.render_on_order)
|
||||
|
||||
|
|
Loading…
Reference in a new issue