2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-07-04 06:00:38 +00:00

Part category parameters (#12165)

* Add parameter support for PartCategory

* Update frontend

* Bump API version

* Update CHANGELOG
This commit is contained in:
Oliver
2026-06-15 18:49:01 +10:00
committed by GitHub
parent 0b5db2f16a
commit d951638e75
6 changed files with 28 additions and 3 deletions
+1
View File
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- [#12165](https://github.com/inventree/InvenTree/pull/12165) adds support for parameters against the PartCategory model
- [#12103](https://github.com/inventree/InvenTree/pull/12103) adds column-based filtering to table views in the user interface. This extends the existing table filtering functionality by allowing users to apply filters directly to individual columns.
- [#12093](https://github.com/inventree/InvenTree/pull/12093) adds "read_only" attribute to PluginSetting API endpoint, which indicates whether a particular plugin setting is read-only (i.e. cannot be modified via the API)
- [#12079](https://github.com/inventree/InvenTree/pull/12079) adds the ability to save filter groups for table and calendar views in the user interface. This allows users to save and reuse commonly used filter configurations, improving the usability and efficiency of the interface.
@@ -1,11 +1,14 @@
"""InvenTree API version information."""
# InvenTree API version
INVENTREE_API_VERSION = 504
INVENTREE_API_VERSION = 505
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """
v505 -> 2026-06-15 : https://github.com/inventree/InvenTree/pull/12165
- Allow parameters to be specified against the PartCategory model
v504 -> 2026-06-13 : https://github.com/inventree/InvenTree/pull/12139
- Adjustments to the SelectionList and SelectionListEntry API endpoints to support more efficient queries and data retrieval
+1
View File
@@ -68,6 +68,7 @@ logger = structlog.get_logger('inventree')
class PartCategory(
InvenTree.models.PluginValidationMixin,
InvenTree.models.InvenTreeParameterMixin,
InvenTree.models.MetadataMixin,
InvenTree.models.PathStringMixin,
InvenTree.models.InvenTreeTree,
@@ -103,6 +103,8 @@ class CategorySerializer(
'structural',
'icon',
'parent_default_location',
# Optional fields
'parameters',
]
read_only_fields = ['level', 'pathstring']
@@ -176,6 +178,8 @@ class CategorySerializer(
parent_default_location = serializers.IntegerField(read_only=True, allow_null=True)
parameters = common.filters.enable_parameters_filter()
class CategoryTree(InvenTree.serializers.InvenTreeModelSerializer):
"""Serializer for PartCategory tree."""
@@ -35,6 +35,7 @@ import InstanceDetail from '../../components/nav/InstanceDetail';
import NavigationTree from '../../components/nav/NavigationTree';
import { PageDetail } from '../../components/nav/PageDetail';
import { PanelGroup } from '../../components/panels/PanelGroup';
import ParametersPanel from '../../components/panels/ParametersPanel';
import SegmentedControlPanel from '../../components/panels/SegmentedControlPanel';
import { partCategoryFields } from '../../forms/PartForms';
import {
@@ -323,9 +324,14 @@ export default function CategoryDetail() {
/>
)
},
ParametersPanel({
model_type: ModelType.partcategory,
model_id: category?.pk,
hidden: !id || !category.pk
}),
{
name: 'category_parameters',
label: t`Category Parameters`,
label: t`Parameter Templates`,
icon: <IconListCheck />,
hidden: !id || !category.pk,
content: <PartCategoryTemplateTable categoryId={category?.pk} />
@@ -1,5 +1,5 @@
import { t } from '@lingui/core/macro';
import { Group, Text } from '@mantine/core';
import { Alert, Group, Stack, Text } from '@mantine/core';
import { useCallback, useMemo, useState } from 'react';
import { AddItemButton } from '@lib/components/AddItemButton';
@@ -15,6 +15,7 @@ import useTable from '@lib/hooks/UseTable';
import type { TableFilter } from '@lib/types/Filters';
import type { ApiFormFieldSet } from '@lib/types/Forms';
import type { TableColumn } from '@lib/types/Tables';
import { IconInfoCircle } from '@tabler/icons-react';
import {
useCreateApiFormModal,
useDeleteApiFormModal,
@@ -152,6 +153,15 @@ export default function PartCategoryTemplateTable({
{newTemplate.modal}
{editTemplate.modal}
{deleteTemplate.modal}
<Alert
color='blue'
icon={<IconInfoCircle />}
title={t`Part Category Parameters Templates`}
>
<Stack gap='xs'>
<Text>{t`Parts which are created within this category will inherit the default values specified here.`}</Text>
</Stack>
</Alert>
<InvenTreeTable
url={apiUrl(ApiEndpoints.category_parameter_list)}
tableState={table}