mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Prevent serial number for stock item with quantity > 1
This commit is contained in:
parent
9ea3d7bf71
commit
feb45513f7
@ -86,3 +86,7 @@
|
||||
align-items: stretch;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.help-inline {
|
||||
color: #A11;
|
||||
}
|
@ -73,6 +73,13 @@ class StockItem(models.Model):
|
||||
# TODO - Find a test than can be perfomed...
|
||||
pass
|
||||
|
||||
# Serial number cannot be set for items with quantity greater than 1
|
||||
if not self.quantity == 1 and self.serial:
|
||||
raise ValidationError({
|
||||
'quantity': _("Quantity must be set to 1 for item with a serial number"),
|
||||
'serial': _("Serial number cannot be set if quantity > 1")
|
||||
})
|
||||
|
||||
def get_absolute_url(self):
|
||||
return '/stock/item/{id}/'.format(id=self.id)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user