mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Cleanup getRequiredParts function
This commit is contained in:
parent
371ec582e1
commit
ce82579930
@ -1083,10 +1083,12 @@ class Part(MPTTModel):
|
|||||||
parts: Set of parts already found (to prevent recursion issues)
|
parts: Set of parts already found (to prevent recursion issues)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for bom_item in self.bom_items.all().select_related('sub_part'):
|
items = self.bom_items.all().prefetch_related('sub_part')
|
||||||
|
|
||||||
|
for bom_item in items:
|
||||||
|
|
||||||
sub_part = bom_item.sub_part
|
sub_part = bom_item.sub_part
|
||||||
|
|
||||||
if sub_part not in parts:
|
if sub_part not in parts:
|
||||||
|
|
||||||
parts.add(sub_part)
|
parts.add(sub_part)
|
||||||
|
Loading…
Reference in New Issue
Block a user