From 96f6f6068e8f469279af18b008b54cd73b8c54e6 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 2 Jun 2019 11:05:40 +1000 Subject: [PATCH] Return message on succses --- InvenTree/stock/views.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index 6101a4dce9..b233f53902 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -251,8 +251,18 @@ class StockItemMoveMultiple(AjaxView, FormMixin): valid = False form.errors['confirm'] = [_('Confirm stock adjustment')] + try: + destination = StockLocation.objects.get(id=form['destination'].value()) + destination_name = destination.pathstring + except StockLocation.DoesNotExist: + destination = None + destination_name = "" + data = { - 'form_valid': False, + 'form_valid': valid, + 'success': _('Moved {n} items to {loc}'.format( + n=len(self.stock_items), + loc=destination_name)) } return self.renderJsonResponse(request, form, data=data)