2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Add "external" field to StockLocation (#4377)

* Add "external" field to StockLocation

- New model for field
- Database migrations
- Serializer / API updates
- Front end tables / filters

* Update API version
This commit is contained in:
Oliver
2023-02-21 00:42:18 +11:00
committed by GitHub
parent 782ae133b7
commit 75ca325892
7 changed files with 54 additions and 2 deletions

View File

@ -310,7 +310,8 @@ class StockLocationList(APIDownloadMixin, ListCreateAPI):
filterset_fields = [
'name',
'structural'
'structural',
'external',
]
search_fields = [

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.18 on 2023-02-20 12:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stock', '0094_auto_20230220_0025'),
]
operations = [
migrations.AddField(
model_name='stocklocation',
name='external',
field=models.BooleanField(default=False, help_text='This is an external stock location', verbose_name='External'),
),
]

View File

@ -122,6 +122,12 @@ class StockLocation(InvenTreeBarcodeMixin, MetadataMixin, InvenTreeTree):
'but may be located to child locations.'),
)
external = models.BooleanField(
default=False,
verbose_name=_('External'),
help_text=_('This is an external stock location')
)
def get_location_owner(self):
"""Get the closest "owner" for this location.

View File

@ -584,6 +584,7 @@ class LocationSerializer(InvenTree.serializers.InvenTreeModelSerializer):
'owner',
'icon',
'structural',
'external',
]
read_only_fields = [