diff --git a/InvenTree/stock/test_views.py b/InvenTree/stock/test_views.py index 809f7d5956..71c7594478 100644 --- a/InvenTree/stock/test_views.py +++ b/InvenTree/stock/test_views.py @@ -159,7 +159,15 @@ class StockItemTest(StockViewTestCase): data = json.loads(response.content) self.assertTrue(data['form_valid']) + # Try again to serialize with the same numbers + response = self.client.post(url, data_valid, HTTP_X_REQUESTED_WITH='XMLHttpRequest') + self.assertEqual(response.status_code, 200) + data = json.loads(response.content) + self.assertFalse(data['form_valid']) + + # POST with invalid data response = self.client.post(url, data_invalid, HTTP_X_REQUESTED_WITH='XMLHttpRequest') self.assertEqual(response.status_code, 200) data = json.loads(response.content) self.assertFalse(data['form_valid']) + diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index 22a0e48dca..61d9517812 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -518,7 +518,7 @@ class StockItemSerialize(AjaxUpdateView): messages = e.message_dict for k in messages.keys(): - if k in ['quantity', 'destionation', 'serial_numbers']: + if k in ['quantity', 'destination', 'serial_numbers']: form.errors[k] = messages[k] else: form.non_field_errors = messages[k]