mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Changes for clean of StockItem
This commit is contained in:
parent
88b90281f5
commit
bc03ae53bd
@ -204,12 +204,15 @@ class StockItem(models.Model):
|
|||||||
})
|
})
|
||||||
|
|
||||||
if self.quantity == 0:
|
if self.quantity == 0:
|
||||||
|
self.quantity = 1
|
||||||
|
|
||||||
|
elif self.quantity > 1:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'quantity': _('Quantity must be 1 for item with a serial number')
|
'quantity': _('Quantity must be 1 for item with a serial number')
|
||||||
})
|
})
|
||||||
|
|
||||||
if self.delete_on_deplete:
|
# Serial numbered items cannot be deleted on depletion
|
||||||
raise ValidationError({'delete_on_deplete': _("Must be set to False for item with a serial number")})
|
self.delete_on_deplete = False
|
||||||
|
|
||||||
# A template part cannot be instantiated as a StockItem
|
# A template part cannot be instantiated as a StockItem
|
||||||
if self.part.is_template:
|
if self.part.is_template:
|
||||||
|
@ -467,6 +467,9 @@ class StockItemCreate(AjaxCreateView):
|
|||||||
Parameters can be pre-filled by passing query items:
|
Parameters can be pre-filled by passing query items:
|
||||||
- part: The part of which the new StockItem is an instance
|
- part: The part of which the new StockItem is an instance
|
||||||
- location: The location of the new StockItem
|
- location: The location of the new StockItem
|
||||||
|
|
||||||
|
If the parent part is a "tracked" part, provide an option to create uniquely serialized items
|
||||||
|
rather than a bulk quantity of stock items
|
||||||
"""
|
"""
|
||||||
|
|
||||||
model = StockItem
|
model = StockItem
|
||||||
|
Loading…
x
Reference in New Issue
Block a user