mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-17 01:38:19 +00:00
Allow adjument of build outputs (#10600)
* Auto-select location * Allow stock adjustments for "in production" items * Tweak stock move check * Allow splitting of production stock * Update CHANGELOG.md
This commit is contained in:
@@ -1743,7 +1743,6 @@ class StockItem(
|
||||
self.belongs_to is None, # Not installed inside another StockItem
|
||||
self.customer is None, # Not assigned to a customer
|
||||
self.consumed_by is None, # Not consumed by a build
|
||||
not self.is_building, # Not part of an active build
|
||||
])
|
||||
|
||||
@property
|
||||
@@ -2221,7 +2220,6 @@ class StockItem(
|
||||
- The new item will have a different StockItem ID, while this will remain the same.
|
||||
"""
|
||||
# Run initial checks to test if the stock item can actually be "split"
|
||||
|
||||
allow_production = kwargs.get('allow_production', False)
|
||||
|
||||
# Cannot split a stock item which is in production
|
||||
@@ -2346,7 +2344,9 @@ class StockItem(
|
||||
'STOCK_ALLOW_OUT_OF_STOCK_TRANSFER', backup_value=False, cache=False
|
||||
)
|
||||
|
||||
if not allow_out_of_stock_transfer and not self.is_in_stock(check_status=False):
|
||||
if not allow_out_of_stock_transfer and not self.is_in_stock(
|
||||
check_status=False, check_in_production=False
|
||||
):
|
||||
raise ValidationError(_('StockItem cannot be moved as it is not in stock'))
|
||||
|
||||
if quantity <= 0:
|
||||
@@ -2362,7 +2362,7 @@ class StockItem(
|
||||
kwargs['notes'] = notes
|
||||
|
||||
# Split the existing StockItem in two
|
||||
self.splitStock(quantity, location, user, **kwargs)
|
||||
self.splitStock(quantity, location, user, allow_production=True, **kwargs)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -1602,7 +1602,7 @@ class StockAdjustmentItemSerializer(serializers.Serializer):
|
||||
)
|
||||
|
||||
if not allow_out_of_stock_transfer and not stock_item.is_in_stock(
|
||||
check_status=False, check_quantity=False
|
||||
check_status=False, check_quantity=False, check_in_production=False
|
||||
):
|
||||
raise ValidationError(_('Stock item is not in stock'))
|
||||
elif self.require_in_stock == False:
|
||||
|
||||
Reference in New Issue
Block a user