From 3820891277a57513f498a74ed3c4cf35425d985f Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 1 Aug 2017 14:48:22 -0500 Subject: [PATCH] Fix batch links when viewing purchase object --- tailbone/views/purchases/core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)