mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Merge pull request #2874 from SchrodingersGat/auto-allocate-fix
Prevent inactive or trackable parts from being 'auto allocated'
This commit is contained in:
commit
4c6c618af6
@ -2732,7 +2732,21 @@ class BomItem(models.Model, DataImportMixin):
|
|||||||
for sub in self.substitutes.all():
|
for sub in self.substitutes.all():
|
||||||
parts.add(sub.part)
|
parts.add(sub.part)
|
||||||
|
|
||||||
return parts
|
valid_parts = []
|
||||||
|
|
||||||
|
for p in parts:
|
||||||
|
|
||||||
|
# Inactive parts cannot be 'auto allocated'
|
||||||
|
if not p.active:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Trackable parts cannot be 'auto allocated'
|
||||||
|
if p.trackable:
|
||||||
|
continue
|
||||||
|
|
||||||
|
valid_parts.append(p)
|
||||||
|
|
||||||
|
return valid_parts
|
||||||
|
|
||||||
def is_stock_item_valid(self, stock_item):
|
def is_stock_item_valid(self, stock_item):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user