mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-05 13:10:57 +00:00
- Creation of BuildItem objects was using old model references
(cherry picked from commit 668dab4175
)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
committed by
GitHub
parent
699fb83dd4
commit
ca986cba01
@ -719,14 +719,22 @@ class Build(MPTTModel, InvenTree.models.InvenTreeBarcodeMixin, InvenTree.models.
|
|||||||
if items.exists() and items.count() == 1:
|
if items.exists() and items.count() == 1:
|
||||||
stock_item = items[0]
|
stock_item = items[0]
|
||||||
|
|
||||||
# Allocate the stock item
|
# Find the 'BuildLine' object which points to this BomItem
|
||||||
BuildItem.objects.create(
|
try:
|
||||||
build=self,
|
build_line = BuildLine.objects.get(
|
||||||
bom_item=bom_item,
|
build=self,
|
||||||
stock_item=stock_item,
|
bom_item=bom_item
|
||||||
quantity=1,
|
)
|
||||||
install_into=output,
|
|
||||||
)
|
# 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:
|
else:
|
||||||
"""Create a single build output of the given quantity."""
|
"""Create a single build output of the given quantity."""
|
||||||
|
Reference in New Issue
Block a user