Fix purchase batch execution, to redirect to Purchase *or* Batch

Depending on what the handler returned from execution
This commit is contained in:
Lance Edgar 2016-12-29 11:56:42 -06:00
parent 4231bf0455
commit 2b7e38d077

View file

@ -518,8 +518,12 @@ class PurchaseBatchView(BatchMasterView):
return self.redirect(self.get_action_url('view', row.batch))
def get_execute_success_url(self, batch, result, **kwargs):
# redirect to associated purchase
return self.request.route_url('purchases.view', uuid=batch.purchase_uuid)
# if batch execution yielded a Purchase, redirect to it
if isinstance(result, model.Purchase):
return self.request.route_url('purchases.view', uuid=result.uuid)
# otherwise just view batch again
return self.get_action_url('view', batch)
def order_form(self):
"""