mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Prevent div-by-zero error (#4967)
- Div-by-zero could occur when calculating how many items can be built for a part - Might result if (somehow) the BomItem has a quantity of zero
This commit is contained in:
parent
45ec7b9728
commit
d8965c6c2b
@ -1302,6 +1302,11 @@ class Part(InvenTreeBarcodeMixin, InvenTreeNotesMixin, MetadataMixin, MPTTModel)
|
||||
)
|
||||
|
||||
for item in queryset.all():
|
||||
|
||||
if item.quantity <= 0:
|
||||
# Ignore zero-quantity items
|
||||
continue
|
||||
|
||||
# Iterate through each item in the queryset, work out the limiting quantity
|
||||
quantity = item.available_stock + item.substitute_stock
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user