From a9e9474f5cfa577356bec123358b0a91de7e6035 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 26 Sep 2023 09:32:57 -0500 Subject: [PATCH] Do not allow executing custorder if no customer is set or really any reason, as defined by handler --- tailbone/views/custorders/orders.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tailbone/views/custorders/orders.py b/tailbone/views/custorders/orders.py index abbcf87c..f88886bb 100644 --- a/tailbone/views/custorders/orders.py +++ b/tailbone/views/custorders/orders.py @@ -956,6 +956,11 @@ class CustomerOrderView(MasterView): 'batch': self.normalize_batch(batch)} def submit_new_order(self, batch, data): + + reason = self.batch_handler.why_not_execute(batch, user=self.request.user) + if reason: + return {'error': reason} + try: result = self.execute_new_order_batch(batch, data) except Exception as error: