mirror of
https://github.com/inventree/InvenTree.git
synced 2026-02-12 17:27:02 +00:00
[build] Check for allocated items which are in production (#11263)
This commit is contained in:
@@ -1222,6 +1222,13 @@ class Build(
|
|||||||
# List the allocated BuildItem objects for the given output
|
# List the allocated BuildItem objects for the given output
|
||||||
allocated_items = output.items_to_install.all()
|
allocated_items = output.items_to_install.all()
|
||||||
|
|
||||||
|
# Ensure that none of the allocated items are themselves still "in production"
|
||||||
|
for build_item in allocated_items:
|
||||||
|
if build_item.stock_item.is_building:
|
||||||
|
raise ValidationError(
|
||||||
|
_('Allocated stock items are still in production')
|
||||||
|
)
|
||||||
|
|
||||||
# If a partial quantity is provided, split the stock output
|
# If a partial quantity is provided, split the stock output
|
||||||
if quantity is not None and quantity != output.quantity:
|
if quantity is not None and quantity != output.quantity:
|
||||||
# Cannot split a build output with allocated items
|
# Cannot split a build output with allocated items
|
||||||
|
|||||||
Reference in New Issue
Block a user