2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 04:55:44 +00:00

Add "exclude_location" to build order auto-allocation

This commit is contained in:
Oliver
2022-03-09 14:57:57 +11:00
parent 927e206e14
commit 4191a043b2
4 changed files with 22 additions and 1 deletions

View File

@ -717,6 +717,7 @@ class BuildAutoAllocationSerializer(serializers.Serializer):
class Meta:
fields = [
'location',
'exclude_location',
'interchangeable',
'substitutes',
]
@ -730,6 +731,15 @@ class BuildAutoAllocationSerializer(serializers.Serializer):
help_text=_('Stock location where parts are to be sourced (leave blank to take from any location)'),
)
exclude_location = serializers.PrimaryKeyRelatedField(
queryset=StockLocation.objects.all(),
many=False,
allow_null=True,
required=False,
label=_('Exclude Location'),
help_text=_('Exclude stock items from this selected location'),
)
interchangeable = serializers.BooleanField(
default=False,
label=_('Interchangeable Stock'),
@ -750,6 +760,7 @@ class BuildAutoAllocationSerializer(serializers.Serializer):
build.auto_allocate_stock(
location=data.get('location', None),
exclude_location=data.get('exclude_location', None),
interchangeable=data['interchangeable'],
substitutes=data['substitutes'],
)