diff --git a/tailbone/views/purchases/core.py b/tailbone/views/purchases/core.py index 12e6676b..4f3337d8 100644 --- a/tailbone/views/purchases/core.py +++ b/tailbone/views/purchases/core.py @@ -45,6 +45,11 @@ class BatchesFieldRenderer(fa.FieldRenderer): enum = self.request.rattail_config.get_enum() + routes = { + enum.PURCHASE_BATCH_MODE_ORDERING: 'ordering.view', + enum.PURCHASE_BATCH_MODE_RECEIVING: 'receiving.view', + } + def render(batch): if batch.executed: actor = batch.executed_by @@ -55,7 +60,7 @@ class BatchesFieldRenderer(fa.FieldRenderer): display = '{} ({} by {}){}'.format(batch.id_str, enum.PURCHASE_BATCH_MODE[batch.mode], actor, pending) - return tags.link_to(display, self.request.route_url('purchases.batch.view', uuid=batch.uuid)) + return tags.link_to(display, self.request.route_url(routes[batch.mode], uuid=batch.uuid)) items = [HTML.tag('li', c=render(batch)) for batch in batches] return HTML.tag('ul', c=items)