2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 11:10:54 +00:00

Fix validation of duplicate IPN

- Duplicate IPN check does not apply if an empty IPN value is set
- Note that "if x" is a more pythonic test than "if x not in [None, '']"
This commit is contained in:
Oliver Walters
2022-04-22 00:36:30 +10:00
parent 42f0628a48
commit 9a9ed5f192
2 changed files with 10 additions and 3 deletions

View File

@ -453,10 +453,12 @@ class StockItem(MPTTModel):
super().clean()
if self.serial is not None and type(self.serial) is str:
# Strip serial number field
if self.serial:
self.serial = self.serial.strip()
if self.batch is not None and type(self.batch) is str:
# Strip batch code field
if self.batch:
self.batch = self.batch.strip()
try: