From 839c4e0c28387435da2df70baf33a537289d55b2 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 14 Aug 2022 17:33:12 -0500 Subject: [PATCH] Add `get_next_url_after_submit_new_order()` for customer orders after new custorder batch is executed, where do we send user? --- tailbone/views/custorders/orders.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tailbone/views/custorders/orders.py b/tailbone/views/custorders/orders.py index 41f7c5f5..cf231374 100644 --- a/tailbone/views/custorders/orders.py +++ b/tailbone/views/custorders/orders.py @@ -924,11 +924,16 @@ class CustomerOrderView(MasterView): if not result: return {'error': "Batch failed to execute"} - next_url = None - if isinstance(result, model.CustomerOrder): - next_url = self.get_action_url('view', result) + return { + 'ok': True, + 'next_url': self.get_next_url_after_submit_new_order(batch, result), + } - return {'ok': True, 'next_url': next_url} + def get_next_url_after_submit_new_order(self, batch, result, **kwargs): + model = self.model + + if isinstance(result, model.CustomerOrder): + return self.get_action_url('view', result) def execute_new_order_batch(self, batch, data): return self.batch_handler.do_execute(batch, self.request.user)