2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-13 08:21:26 +00:00

Refactor how form errors are handled

- When in doubt, refer to the django docs
- There was a *much* better way (thanks, form.add_error)!
- The anti-pattern was deleted, and lo, there was much rejoicing
- Some other refactoring too
This commit is contained in:
Oliver Walters
2020-10-28 23:33:33 +11:00
parent d06b4d7c9f
commit 091a9d9803
8 changed files with 112 additions and 88 deletions

View File

@ -407,6 +407,13 @@ class VariantTest(StockTest):
self.assertEqual(chair.getLatestSerialNumber(), '22')
# Check for conflicting serial numbers
to_check = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
conflicts = chair.find_conflicting_serial_numbers(to_check)
self.assertEqual(len(conflicts), 6)
# Same operations on a sub-item
variant = Part.objects.get(pk=10003)
self.assertEqual(variant.getLatestSerialNumber(), '22')