mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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:
parent
782ae133b7
commit
75ca325892
@ -2,11 +2,14 @@
|
||||
|
||||
|
||||
# InvenTree API version
|
||||
INVENTREE_API_VERSION = 96
|
||||
INVENTREE_API_VERSION = 97
|
||||
|
||||
"""
|
||||
Increment this API version number whenever there is a significant change to the API that any clients need to know about
|
||||
|
||||
v97 -> 2023-02-20 : https://github.com/inventree/InvenTree/pull/4377
|
||||
- Adds "external" attribute to StockLocation model
|
||||
|
||||
v96 -> 2023-02-16 : https://github.com/inventree/InvenTree/pull/4345
|
||||
- Adds stocktake report generation functionality
|
||||
|
||||
|
@ -310,7 +310,8 @@ class StockLocationList(APIDownloadMixin, ListCreateAPI):
|
||||
|
||||
filterset_fields = [
|
||||
'name',
|
||||
'structural'
|
||||
'structural',
|
||||
'external',
|
||||
]
|
||||
|
||||
search_fields = [
|
||||
|
18
InvenTree/stock/migrations/0095_stocklocation_external.py
Normal file
18
InvenTree/stock/migrations/0095_stocklocation_external.py
Normal 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'),
|
||||
),
|
||||
]
|
@ -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.
|
||||
|
||||
|
@ -584,6 +584,7 @@ class LocationSerializer(InvenTree.serializers.InvenTreeModelSerializer):
|
||||
'owner',
|
||||
'icon',
|
||||
'structural',
|
||||
'external',
|
||||
]
|
||||
|
||||
read_only_fields = [
|
||||
|
@ -117,6 +117,7 @@ function stockLocationFields(options={}) {
|
||||
description: {},
|
||||
owner: {},
|
||||
structural: {},
|
||||
external: {},
|
||||
icon: {
|
||||
help_text: `{% trans "Icon (optional) - Explore all available icons on" %} <a href="https://fontawesome.com/v5/search?s=solid" target="_blank" rel="noopener noreferrer">Font Awesome</a>.`,
|
||||
placeholder: 'fas fa-box',
|
||||
@ -2491,6 +2492,24 @@ function loadStockLocationTable(table, options) {
|
||||
title: '{% trans "Stock Items" %}',
|
||||
switchable: true,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
field: 'structural',
|
||||
title: '{% trans "Structural" %}',
|
||||
switchable: true,
|
||||
sortable: false,
|
||||
formatter: function(value) {
|
||||
return yesNoLabel(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'external',
|
||||
title: '{% trans "External" %}',
|
||||
switchable: true,
|
||||
sortable: false,
|
||||
formatter: function(value) {
|
||||
return yesNoLabel(value);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
@ -134,6 +134,10 @@ function getAvailableTableFilters(tableKey) {
|
||||
type: 'bool',
|
||||
title: '{% trans "Structural" %}',
|
||||
},
|
||||
external: {
|
||||
type: 'bool',
|
||||
title: '{% trans "External" %}',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user