mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 19:46:46 +00:00
Build Line Updates (#7591)
* Update build line tables * Add additional fiels to BuildLine serializer * Bump API version
This commit is contained in:
parent
c05cf86c8e
commit
e943c5a686
@ -1,12 +1,15 @@
|
|||||||
"""InvenTree API version information."""
|
"""InvenTree API version information."""
|
||||||
|
|
||||||
# InvenTree API version
|
# InvenTree API version
|
||||||
INVENTREE_API_VERSION = 214
|
INVENTREE_API_VERSION = 215
|
||||||
|
|
||||||
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
||||||
|
|
||||||
|
|
||||||
INVENTREE_API_TEXT = """
|
INVENTREE_API_TEXT = """
|
||||||
|
v215 - 2024-07-09 : https://github.com/inventree/InvenTree/pull/7591
|
||||||
|
- Adds additional fields to the BuildLine serializer
|
||||||
|
|
||||||
v214 - 2024-07-08 : https://github.com/inventree/InvenTree/pull/7587
|
v214 - 2024-07-08 : https://github.com/inventree/InvenTree/pull/7587
|
||||||
- Adds "default_location_detail" field to the Part API
|
- Adds "default_location_detail" field to the Part API
|
||||||
|
|
||||||
|
@ -1139,6 +1139,11 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali
|
|||||||
'allocations',
|
'allocations',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export_only_fields = [
|
||||||
|
'part_description',
|
||||||
|
'part_category_name',
|
||||||
|
]
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
"""Serializer metaclass"""
|
"""Serializer metaclass"""
|
||||||
|
|
||||||
@ -1157,11 +1162,14 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali
|
|||||||
'consumable',
|
'consumable',
|
||||||
'optional',
|
'optional',
|
||||||
'trackable',
|
'trackable',
|
||||||
|
'inherited',
|
||||||
|
'allow_variants',
|
||||||
|
|
||||||
# Part detail fields
|
# Part detail fields
|
||||||
'part',
|
'part',
|
||||||
'part_name',
|
'part_name',
|
||||||
'part_IPN',
|
'part_IPN',
|
||||||
|
'part_category_id',
|
||||||
|
|
||||||
# Annotated fields
|
# Annotated fields
|
||||||
'allocated',
|
'allocated',
|
||||||
@ -1172,6 +1180,10 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali
|
|||||||
'available_variant_stock',
|
'available_variant_stock',
|
||||||
'total_available_stock',
|
'total_available_stock',
|
||||||
'external_stock',
|
'external_stock',
|
||||||
|
|
||||||
|
# Extra fields only for data export
|
||||||
|
'part_description',
|
||||||
|
'part_category_name',
|
||||||
]
|
]
|
||||||
|
|
||||||
read_only_fields = [
|
read_only_fields = [
|
||||||
@ -1185,11 +1197,17 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali
|
|||||||
part_name = serializers.CharField(source='bom_item.sub_part.name', label=_('Part Name'), read_only=True)
|
part_name = serializers.CharField(source='bom_item.sub_part.name', label=_('Part Name'), read_only=True)
|
||||||
part_IPN = serializers.CharField(source='bom_item.sub_part.IPN', label=_('Part IPN'), read_only=True)
|
part_IPN = serializers.CharField(source='bom_item.sub_part.IPN', label=_('Part IPN'), read_only=True)
|
||||||
|
|
||||||
|
part_description = serializers.CharField(source='bom_item.sub_part.description', label=_('Part Description'), read_only=True)
|
||||||
|
part_category_id = serializers.PrimaryKeyRelatedField(source='bom_item.sub_part.category', label=_('Part Category ID'), read_only=True)
|
||||||
|
part_category_name = serializers.CharField(source='bom_item.sub_part.category.name', label=_('Part Category Name'), read_only=True)
|
||||||
|
|
||||||
# BOM item info fields
|
# BOM item info fields
|
||||||
reference = serializers.CharField(source='bom_item.reference', label=_('Reference'), read_only=True)
|
reference = serializers.CharField(source='bom_item.reference', label=_('Reference'), read_only=True)
|
||||||
consumable = serializers.BooleanField(source='bom_item.consumable', label=_('Consumable'), read_only=True)
|
consumable = serializers.BooleanField(source='bom_item.consumable', label=_('Consumable'), read_only=True)
|
||||||
optional = serializers.BooleanField(source='bom_item.optional', label=_('Optional'), read_only=True)
|
optional = serializers.BooleanField(source='bom_item.optional', label=_('Optional'), read_only=True)
|
||||||
trackable = serializers.BooleanField(source='bom_item.sub_part.trackable', label=_('Trackable'), read_only=True)
|
trackable = serializers.BooleanField(source='bom_item.sub_part.trackable', label=_('Trackable'), read_only=True)
|
||||||
|
inherited = serializers.BooleanField(source='bom_item.inherited', label=_('Inherited'), read_only=True)
|
||||||
|
allow_variants = serializers.BooleanField(source='bom_item.allow_variants', label=_('Allow Variants'), read_only=True)
|
||||||
|
|
||||||
quantity = serializers.FloatField(label=_('Quantity'))
|
quantity = serializers.FloatField(label=_('Quantity'))
|
||||||
|
|
||||||
|
@ -2516,6 +2516,15 @@ function loadBuildLineTable(table, build_id, options={}) {
|
|||||||
return row.bom_item_detail.reference;
|
return row.bom_item_detail.reference;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'optional',
|
||||||
|
title: '{% trans "Optional" %}',
|
||||||
|
sortable: true,
|
||||||
|
switchable: true,
|
||||||
|
formatter: function(value, row) {
|
||||||
|
return yesNoLabel(row.bom_item_detail.optional);
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'consumable',
|
field: 'consumable',
|
||||||
title: '{% trans "Consumable" %}',
|
title: '{% trans "Consumable" %}',
|
||||||
@ -2526,12 +2535,21 @@ function loadBuildLineTable(table, build_id, options={}) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'optional',
|
field: 'allow_variants',
|
||||||
title: '{% trans "Optional" %}',
|
title: '{% trans "Allow Variants" %}',
|
||||||
sortable: true,
|
sortable: false,
|
||||||
switchable: true,
|
switchable: true,
|
||||||
formatter: function(value, row) {
|
formatter: function(value, row) {
|
||||||
return yesNoLabel(row.bom_item_detail.optional);
|
return yesNoLabel(row.bom_item_detail.allow_variants);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'inherited',
|
||||||
|
title: '{% trans "Gets Inherited" %}',
|
||||||
|
sortable: false,
|
||||||
|
switchable: true,
|
||||||
|
formatter: function(value, row) {
|
||||||
|
return yesNoLabel(row.bom_item_detail.inherited);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -139,13 +139,22 @@ export default function BuildLineTable({ params = {} }: { params?: any }) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
title: t`Reference`
|
title: t`Reference`
|
||||||
},
|
},
|
||||||
|
BooleanColumn({
|
||||||
|
accessor: 'bom_item_detail.optional',
|
||||||
|
ordering: 'optional'
|
||||||
|
}),
|
||||||
BooleanColumn({
|
BooleanColumn({
|
||||||
accessor: 'bom_item_detail.consumable',
|
accessor: 'bom_item_detail.consumable',
|
||||||
ordering: 'consumable'
|
ordering: 'consumable'
|
||||||
}),
|
}),
|
||||||
BooleanColumn({
|
BooleanColumn({
|
||||||
accessor: 'bom_item_detail.optional',
|
accessor: 'bom_item_detail.allow_variants',
|
||||||
ordering: 'optional'
|
ordering: 'allow_variants'
|
||||||
|
}),
|
||||||
|
BooleanColumn({
|
||||||
|
accessor: 'bom_item_detail.inherited',
|
||||||
|
ordering: 'inherited',
|
||||||
|
title: t`Gets Inherited`
|
||||||
}),
|
}),
|
||||||
BooleanColumn({
|
BooleanColumn({
|
||||||
accessor: 'part_detail.trackable',
|
accessor: 'part_detail.trackable',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user