mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 04:55:44 +00:00
Request column names from server when loading table (#6375)
* Request column names from server when loading table - As these are translated by the server, we can make use of them on the client side! - Reduces duplication of translated titles * Move tables up one level * Cache translated table column names * Clear table column cache whenever we change locale context * Fix cache behavioue * Enforce titleCase for table column names * Refactor BuildOrder table * Refactor Company table * Refactor order tables * More refactoring - Refactoring more columns * Update more tables * Refactor BomTable * Remove toTitleCase - We will rely on the server-side translations! * Remove debug messages * Update src/frontend/src/tables/InvenTreeTable.tsx Co-authored-by: Matthias Mair <code@mjmair.com> * Cleanup * Update docstring * Cleanup * Support nested fields with dot notation - Powerful code reuse is powerful * Complete refactor for BuildLine table - Add some missing field descriptors on the backend * Cleanup hooks a bit * Update BomTable * Allow table filters to make use of the same info * Add ReferenceColumn helper * Use queryParams when fetching table OPTIONS - Required to ensure the same columns are fetched * More refactoring * Fix ProjectCodeTable * Code cleanup * Fix unused var --------- Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
@ -1075,16 +1075,34 @@ class BuildLineSerializer(InvenTreeModelSerializer):
|
||||
|
||||
quantity = serializers.FloatField()
|
||||
|
||||
bom_item = serializers.PrimaryKeyRelatedField(label=_('Bom Item'), read_only=True)
|
||||
|
||||
# Foreign key fields
|
||||
bom_item_detail = BomItemSerializer(source='bom_item', many=False, read_only=True, pricing=False)
|
||||
part_detail = PartSerializer(source='bom_item.sub_part', many=False, read_only=True, pricing=False)
|
||||
allocations = BuildItemSerializer(many=True, read_only=True)
|
||||
|
||||
# Annotated (calculated) fields
|
||||
allocated = serializers.FloatField(read_only=True)
|
||||
on_order = serializers.FloatField(read_only=True)
|
||||
in_production = serializers.FloatField(read_only=True)
|
||||
available_stock = serializers.FloatField(read_only=True)
|
||||
allocated = serializers.FloatField(
|
||||
label=_('Allocated Stock'),
|
||||
read_only=True
|
||||
)
|
||||
|
||||
on_order = serializers.FloatField(
|
||||
label=_('On Order'),
|
||||
read_only=True
|
||||
)
|
||||
|
||||
in_production = serializers.FloatField(
|
||||
label=_('In Production'),
|
||||
read_only=True
|
||||
)
|
||||
|
||||
available_stock = serializers.FloatField(
|
||||
label=_('Available Stock'),
|
||||
read_only=True
|
||||
)
|
||||
|
||||
available_substitute_stock = serializers.FloatField(read_only=True)
|
||||
available_variant_stock = serializers.FloatField(read_only=True)
|
||||
total_available_stock = serializers.FloatField(read_only=True)
|
||||
|
Reference in New Issue
Block a user