From 0171f3ebba1503eae896ba718210dff8113ee4ba Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 1 Aug 2017 14:42:32 -0500 Subject: [PATCH] Various improvements to batch worksheets, index links etc. --- tailbone/templates/mobile/master/index.mako | 6 +++++- tailbone/templates/mobile/receiving/index.mako | 10 ---------- tailbone/templates/ordering/order_form.mako | 8 ++++---- tailbone/templates/ordering/view.mako | 2 +- tailbone/templates/purchases/index.mako | 11 ----------- tailbone/views/purchasing/ordering.py | 4 ++-- tailbone/views/purchasing/receiving.py | 1 + 7 files changed, 13 insertions(+), 29 deletions(-) delete mode 100644 tailbone/templates/mobile/receiving/index.mako delete mode 100644 tailbone/templates/purchases/index.mako diff --git a/tailbone/templates/mobile/master/index.mako b/tailbone/templates/mobile/master/index.mako index 25af12de..b4431b69 100644 --- a/tailbone/templates/mobile/master/index.mako +++ b/tailbone/templates/mobile/master/index.mako @@ -7,6 +7,10 @@ ## ############################################################################## <%inherit file="/mobile/base.mako" /> -<%def name="title()">${model_title_plural} +<%def name="title()">${index_title} + +% if master.mobile_creatable and request.has_perm('{}.create'.format(permission_prefix)): + ${h.link_to("New {}".format(model_title), url('mobile.{}.create'.format(route_prefix)), class_='ui-btn ui-corner-all')} +% endif ${grid.render_complete()|n} diff --git a/tailbone/templates/mobile/receiving/index.mako b/tailbone/templates/mobile/receiving/index.mako deleted file mode 100644 index 10941783..00000000 --- a/tailbone/templates/mobile/receiving/index.mako +++ /dev/null @@ -1,10 +0,0 @@ -## -*- coding: utf-8; -*- -<%inherit file="/mobile/master/index.mako" /> - -<%def name="title()">Receiving - -% if request.has_perm('receiving.create'): - ${h.link_to("New Receiving Batch", url('mobile.receiving.create'), class_='ui-btn ui-corner-all')} -% endif - -${parent.body()} diff --git a/tailbone/templates/ordering/order_form.mako b/tailbone/templates/ordering/order_form.mako index b682c7f1..bca0ff6f 100644 --- a/tailbone/templates/ordering/order_form.mako +++ b/tailbone/templates/ordering/order_form.mako @@ -1,7 +1,7 @@ ## -*- coding: utf-8; -*- <%inherit file="/base.mako" /> -<%def name="title()">Purchase Order Form +<%def name="title()">Ordering Worksheet <%def name="extra_javascript()"> ${parent.extra_javascript()} @@ -237,8 +237,8 @@ ${h.end_form()} - % for cost in subdepartment._order_costs: - + % for i, cost in enumerate(subdepartment._order_costs, 1): + ${self.order_form_row(cost)} % for data in history: @@ -270,7 +270,7 @@ ${h.end_form()} ${h.text('units_ordered_{}'.format(cost.uuid), value=int(cost._batchrow.units_ordered or 0) if cost._batchrow else None)} - ${'${:0,.2f}'.format(cost._batchrow.po_total) if cost._batchrow else ''} + ${'${:0,.2f}'.format(cost._batchrow.po_total or 0) if cost._batchrow else ''} ${self.extra_td(cost)} % endfor diff --git a/tailbone/templates/ordering/view.mako b/tailbone/templates/ordering/view.mako index 04c7526d..4d12e643 100644 --- a/tailbone/templates/ordering/view.mako +++ b/tailbone/templates/ordering/view.mako @@ -36,7 +36,7 @@ <%def name="leading_buttons()"> % if not batch.complete and not batch.executed and request.has_perm('ordering.order_form'): - + % endif diff --git a/tailbone/templates/purchases/index.mako b/tailbone/templates/purchases/index.mako deleted file mode 100644 index 38a665ee..00000000 --- a/tailbone/templates/purchases/index.mako +++ /dev/null @@ -1,11 +0,0 @@ -## -*- coding: utf-8; -*- -<%inherit file="/master/index.mako" /> - -<%def name="context_menu_items()"> - ${parent.context_menu_items()} - % if request.has_perm('purchases.batch.list'): -
  • ${h.link_to("Go to Purchasing Batches", url('purchases.batch'))}
  • - % endif - - -${parent.body()} diff --git a/tailbone/views/purchasing/ordering.py b/tailbone/views/purchasing/ordering.py index 91271912..7f16c9b6 100644 --- a/tailbone/views/purchasing/ordering.py +++ b/tailbone/views/purchasing/ordering.py @@ -50,6 +50,7 @@ class OrderingBatchView(PurchasingBatchView): url_prefix = '/ordering' model_title = "Ordering Batch" model_title_plural = "Ordering Batches" + index_title = "Ordering" row_grid_columns = [ 'sequence', @@ -144,8 +145,7 @@ class OrderingBatchView(PurchasingBatchView): 'batch': batch, 'instance': batch, 'instance_title': title, - 'index_title': "{}: {}".format(self.get_model_title(), title), - 'index_url': self.get_action_url('view', batch), + 'instance_url': self.get_action_url('view', batch), 'vendor': batch.vendor, 'departments': departments, 'history': history, diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index 1d7e2336..4a14bc45 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -88,6 +88,7 @@ class ReceivingBatchView(PurchasingBatchView): url_prefix = '/receiving' model_title = "Receiving Batch" model_title_plural = "Receiving Batches" + index_title = "Receiving" creatable = False rows_deletable = False mobile_creatable = True