2
0
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:
Oliver Walters
2020-08-18 14:17:59 +10:00
parent ca4d3df287
commit 92ac93aac5
2 changed files with 47 additions and 17 deletions

View File

@@ -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: