mirror of
https://github.com/inventree/InvenTree.git
synced 2025-09-04 01:35:54 +00:00
More intelligent checking for circular BOM
- Check all the way down a BOM "tree" - Validate BOM tree before allowing BOM submission
This commit is contained in:
@@ -1325,8 +1325,16 @@ class BomUpload(FormView):
|
||||
|
||||
for row in self.bom_rows:
|
||||
# Has a part been selected for the given row?
|
||||
if row.get('part', None) is None:
|
||||
part = row.get('part', None)
|
||||
|
||||
if part is None:
|
||||
row['errors']['part'] = _('Select a part')
|
||||
else:
|
||||
# Will the selected part result in a recursive BOM?
|
||||
try:
|
||||
part.checkAddToBOM(self.part)
|
||||
except ValidationError:
|
||||
row['errors']['part'] = _('Selected part creates a circular BOM')
|
||||
|
||||
# Has a quantity been specified?
|
||||
if row.get('quantity', None) is None:
|
||||
|
Reference in New Issue
Block a user