mirror of
https://github.com/inventree/InvenTree.git
synced 2025-09-14 06:31:27 +00:00
[UI] Build page tweak (#10027)
* Hide "consumed stock" panel if not required * Docs updates * Hide allocation fields if the build has no required parts * Additional serializer options
This commit is contained in:
@@ -532,8 +532,10 @@ class BuildLineEndpoint:
|
||||
try:
|
||||
params = self.request.query_params
|
||||
|
||||
kwargs['bom_item_detail'] = str2bool(params.get('bom_item_detail', True))
|
||||
kwargs['part_detail'] = str2bool(params.get('part_detail', True))
|
||||
kwargs['build_detail'] = str2bool(params.get('build_detail', False))
|
||||
kwargs['allocations'] = str2bool(params.get('allocations', True))
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
@@ -1328,19 +1328,27 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Determine which extra details fields should be included."""
|
||||
part_detail = kwargs.pop('part_detail', True)
|
||||
bom_item_detail = kwargs.pop('bom_item_detail', True)
|
||||
build_detail = kwargs.pop('build_detail', True)
|
||||
allocations = kwargs.pop('allocations', True)
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
if isGeneratingSchema():
|
||||
return
|
||||
|
||||
if not bom_item_detail:
|
||||
self.fields.pop('bom_item_detail', None)
|
||||
|
||||
if not part_detail:
|
||||
self.fields.pop('part_detail', None)
|
||||
|
||||
if not build_detail:
|
||||
self.fields.pop('build_detail', None)
|
||||
|
||||
if not allocations:
|
||||
self.fields.pop('allocations', None)
|
||||
|
||||
# Build info fields
|
||||
build_reference = serializers.CharField(
|
||||
source='build.reference', label=_('Build Reference'), read_only=True
|
||||
|
Reference in New Issue
Block a user