mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix auto-allocation of build outputs (#5378)
- Creation of BuildItem objects was using old model references
This commit is contained in:
parent
ee5416719f
commit
668dab4175
@ -719,14 +719,22 @@ class Build(MPTTModel, InvenTree.models.InvenTreeBarcodeMixin, InvenTree.models.
|
||||
if items.exists() and items.count() == 1:
|
||||
stock_item = items[0]
|
||||
|
||||
# Allocate the stock item
|
||||
BuildItem.objects.create(
|
||||
# Find the 'BuildLine' object which points to this BomItem
|
||||
try:
|
||||
build_line = BuildLine.objects.get(
|
||||
build=self,
|
||||
bom_item=bom_item,
|
||||
bom_item=bom_item
|
||||
)
|
||||
|
||||
# Allocate the stock items against the BuildLine
|
||||
BuildItem.objects.create(
|
||||
build_line=build_line,
|
||||
stock_item=stock_item,
|
||||
quantity=1,
|
||||
install_into=output,
|
||||
)
|
||||
except BuildLine.DoesNotExist:
|
||||
pass
|
||||
|
||||
else:
|
||||
"""Create a single build output of the given quantity."""
|
||||
|
Loading…
Reference in New Issue
Block a user