mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 03:00:54 +00:00
BOM Table Improvements (#3310)
* Bug fix for "multi delete" form - Was requesting entire LIST endpoint before launching form - Could cause extremely long delays before window opened * Improve rendering of "no stock available" in BOM table * Adds footer row to BOM table - Display total number of parts - Display minimum "can build" amount * Added extra information to footer row * Annotate 'ordering' quantity to BOM list - Display this quantity in the BOM table * Bump API version * JS linting * Allow BOM list to be filtered by "on_order" parameter * Add information showing amount that can be built once orders are received
This commit is contained in:
@ -524,6 +524,8 @@ class BomItemSerializer(InvenTreeModelSerializer):
|
||||
|
||||
purchase_price_range = serializers.SerializerMethodField()
|
||||
|
||||
on_order = serializers.FloatField(read_only=True)
|
||||
|
||||
# Annotated fields for available stock
|
||||
available_stock = serializers.FloatField(read_only=True)
|
||||
available_substitute_stock = serializers.FloatField(read_only=True)
|
||||
@ -593,6 +595,11 @@ class BomItemSerializer(InvenTreeModelSerializer):
|
||||
|
||||
ref = 'sub_part__'
|
||||
|
||||
# Annotate with the total "on order" amount for the sub-part
|
||||
queryset = queryset.annotate(
|
||||
on_order=part.filters.annotate_on_order_quantity(ref),
|
||||
)
|
||||
|
||||
# Calculate "total stock" for the referenced sub_part
|
||||
# Calculate the "build_order_allocations" for the sub_part
|
||||
# Note that these fields are only aliased, not annotated
|
||||
@ -719,6 +726,8 @@ class BomItemSerializer(InvenTreeModelSerializer):
|
||||
'available_substitute_stock',
|
||||
'available_variant_stock',
|
||||
|
||||
# Annotated field describing quantity on order
|
||||
'on_order',
|
||||
]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user