Trackable items must have serial number set

This commit is contained in:
Oliver 2018-04-29 17:06:22 +10:00
parent feb45513f7
commit 3403af18c8

View File

@ -68,6 +68,12 @@ class StockItem(models.Model):
pe=str(self.part))
})
if self.part is not None:
if self.part.trackable and not self.serial:
raise ValidationError({
'serial': _('Serial number must be set for trackable items')
})
except Part.DoesNotExist:
# This gets thrown if self.supplier_part is null
# TODO - Find a test than can be perfomed...