Add "on order" count to products grid, tweak product notes panel

This commit is contained in:
Lance Edgar 2017-08-01 14:51:21 -05:00
parent 3820891277
commit 93fa361292
2 changed files with 9 additions and 1 deletions

View file

@ -209,7 +209,7 @@
<div class="panel"> <div class="panel">
<h2>Notes</h2> <h2>Notes</h2>
<div class="panel-body"> <div class="panel-body">
${render_field_readonly(form.fieldset.notes)} <div class="field">${form.fieldset.notes.render_readonly()}</div>
</div> </div>
</div> </div>
</%def> </%def>

View file

@ -182,6 +182,7 @@ class ProductsView(MasterView):
g.sorters['subdepartment'] = g.make_sorter(model.Subdepartment.name) g.sorters['subdepartment'] = g.make_sorter(model.Subdepartment.name)
g.sorters['vendor'] = g.make_sorter(model.Vendor.name) g.sorters['vendor'] = g.make_sorter(model.Vendor.name)
g.set_sorter('on_hand', model.ProductInventory.on_hand) g.set_sorter('on_hand', model.ProductInventory.on_hand)
g.set_sorter('on_order', model.ProductInventory.on_order)
g.filters['upc'].default_active = True g.filters['upc'].default_active = True
g.filters['upc'].default_verb = 'equal' g.filters['upc'].default_verb = 'equal'
@ -219,6 +220,7 @@ class ProductsView(MasterView):
g.set_renderer('current_price', self.render_price) g.set_renderer('current_price', self.render_price)
g.set_renderer('cost', self.render_cost) g.set_renderer('cost', self.render_cost)
g.set_renderer('on_hand', self.render_on_hand) g.set_renderer('on_hand', self.render_on_hand)
g.set_renderer('on_order', self.render_on_order)
g.set_link('upc') g.set_link('upc')
g.set_link('item_id') g.set_link('item_id')
@ -262,6 +264,12 @@ class ProductsView(MasterView):
return "" return ""
return pretty_quantity(inventory.on_hand) return pretty_quantity(inventory.on_hand)
def render_on_order(self, product, column):
inventory = product.inventory
if not inventory:
return ""
return pretty_quantity(inventory.on_order)
def template_kwargs_index(self, **kwargs): def template_kwargs_index(self, **kwargs):
if self.print_labels: if self.print_labels:
kwargs['label_profiles'] = Session.query(model.LabelProfile)\ kwargs['label_profiles'] = Session.query(model.LabelProfile)\