mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix for issue 6442 (#6443)
- Add null option to status field for stock adjustment - Prevent stock adjustments from setting status to OK
This commit is contained in:
parent
fdd70263ea
commit
edd6f25411
@ -1193,6 +1193,14 @@ class StockMergeSerializer(serializers.Serializer):
|
||||
)
|
||||
|
||||
|
||||
def stock_item_adjust_status_options():
|
||||
"""Return a custom set of options for the StockItem status adjustment field.
|
||||
|
||||
In particular, include a Null option for the status field.
|
||||
"""
|
||||
return [(None, _('No Change'))] + InvenTree.status_codes.StockStatus.items()
|
||||
|
||||
|
||||
class StockAdjustmentItemSerializer(serializers.Serializer):
|
||||
"""Serializer for a single StockItem within a stock adjument request.
|
||||
|
||||
@ -1235,8 +1243,8 @@ class StockAdjustmentItemSerializer(serializers.Serializer):
|
||||
)
|
||||
|
||||
status = serializers.ChoiceField(
|
||||
choices=InvenTree.status_codes.StockStatus.items(),
|
||||
default=InvenTree.status_codes.StockStatus.OK.value,
|
||||
choices=stock_item_adjust_status_options(),
|
||||
default=None,
|
||||
label=_('Status'),
|
||||
help_text=_('Stock item status code'),
|
||||
required=False,
|
||||
@ -1373,8 +1381,8 @@ class StockTransferSerializer(StockAdjustmentSerializer):
|
||||
kwargs = {}
|
||||
|
||||
for field_name in StockItem.optional_transfer_fields():
|
||||
if field_name in item:
|
||||
kwargs[field_name] = item[field_name]
|
||||
if field_value := item.get(field_name, None):
|
||||
kwargs[field_name] = field_value
|
||||
|
||||
stock_item.move(
|
||||
location, notes, request.user, quantity=quantity, **kwargs
|
||||
|
Loading…
Reference in New Issue
Block a user