mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Remove old unused functions
This commit is contained in:
parent
3dde0dbb2b
commit
bb164ed72a
@ -899,7 +899,7 @@ class Build(MPTTModel, ReferenceIndexingMixin):
|
|||||||
|
|
||||||
return self.unallocated_quantity(bom_item, output) == 0
|
return self.unallocated_quantity(bom_item, output) == 0
|
||||||
|
|
||||||
def is_fully_allocated(self, output, verbose=False):
|
def is_fully_allocated(self, output):
|
||||||
"""
|
"""
|
||||||
Returns True if the particular build output is fully allocated.
|
Returns True if the particular build output is fully allocated.
|
||||||
"""
|
"""
|
||||||
@ -969,57 +969,6 @@ class Build(MPTTModel, ReferenceIndexingMixin):
|
|||||||
|
|
||||||
return parts
|
return parts
|
||||||
|
|
||||||
def availableStockItems(self, part, output):
|
|
||||||
"""
|
|
||||||
Returns stock items which are available for allocation to this build.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
part - Part object
|
|
||||||
output - The particular build output
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Grab initial query for items which are "in stock" and match the part
|
|
||||||
items = StockModels.StockItem.objects.filter(
|
|
||||||
StockModels.StockItem.IN_STOCK_FILTER
|
|
||||||
)
|
|
||||||
|
|
||||||
# Check if variants are allowed for this part
|
|
||||||
try:
|
|
||||||
bom_item = PartModels.BomItem.objects.get(part=self.part, sub_part=part)
|
|
||||||
allow_part_variants = bom_item.allow_variants
|
|
||||||
except PartModels.BomItem.DoesNotExist:
|
|
||||||
allow_part_variants = False
|
|
||||||
|
|
||||||
if allow_part_variants:
|
|
||||||
parts = part.get_descendants(include_self=True)
|
|
||||||
items = items.filter(part__pk__in=[p.pk for p in parts])
|
|
||||||
|
|
||||||
else:
|
|
||||||
items = items.filter(part=part)
|
|
||||||
|
|
||||||
# Exclude any items which have already been allocated
|
|
||||||
allocated = BuildItem.objects.filter(
|
|
||||||
build=self,
|
|
||||||
stock_item__part=part,
|
|
||||||
install_into=output,
|
|
||||||
)
|
|
||||||
|
|
||||||
items = items.exclude(
|
|
||||||
id__in=[item.stock_item.id for item in allocated.all()]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Limit query to stock items which are "downstream" of the source location
|
|
||||||
if self.take_from is not None:
|
|
||||||
items = items.filter(
|
|
||||||
location__in=[loc for loc in self.take_from.getUniqueChildren()]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Exclude expired stock items
|
|
||||||
if not common.models.InvenTreeSetting.get_setting('STOCK_ALLOW_EXPIRED_BUILD'):
|
|
||||||
items = items.exclude(StockModels.StockItem.EXPIRED_FILTER)
|
|
||||||
|
|
||||||
return items
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
""" Is this build active? An active build is either:
|
""" Is this build active? An active build is either:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user