2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Refactoring Build model functions

- Determining if a build order is correctly allocated has become more complex
- Complex BOM behaviours (e.g. variants, templates, and substitutes) have made it more difficult!
- Recently, a reference to the defining BomItem object was added to the BuildItem model
- Now, a simpler way is to check allocation against the parent BomItem
- It is much better, but means that a lot of refactoring and testing will be required!
This commit is contained in:
Oliver
2022-02-25 15:40:49 +11:00
parent 50a45474da
commit 44008f33e2
5 changed files with 55 additions and 94 deletions

View File

@ -160,7 +160,7 @@ class BuildOutputSerializer(serializers.Serializer):
if to_complete:
# The build output must have all tracked parts allocated
if not build.isFullyAllocated(output):
if not build.is_fully_allocated(output):
raise ValidationError(_("This build output is not fully allocated"))
return output
@ -436,7 +436,7 @@ class BuildCompleteSerializer(serializers.Serializer):
build = self.context['build']
if not build.areUntrackedPartsFullyAllocated() and not value:
if not build.are_untracked_parts_allocated() and not value:
raise ValidationError(_('Required stock has not been fully allocated'))
return value