diff --git a/CHANGELOG.md b/CHANGELOG.md index 3156935ee4..2abba4e75e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index a137a1571a..7498f02e5d 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -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 diff --git a/src/backend/InvenTree/part/models.py b/src/backend/InvenTree/part/models.py index 9ffe3d42e9..876b5e521b 100644 --- a/src/backend/InvenTree/part/models.py +++ b/src/backend/InvenTree/part/models.py @@ -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, diff --git a/src/backend/InvenTree/part/serializers.py b/src/backend/InvenTree/part/serializers.py index ccbce76492..d0ce0d43fa 100644 --- a/src/backend/InvenTree/part/serializers.py +++ b/src/backend/InvenTree/part/serializers.py @@ -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.""" diff --git a/src/frontend/src/pages/part/CategoryDetail.tsx b/src/frontend/src/pages/part/CategoryDetail.tsx index 2f4dcc6e53..4c47958da5 100644 --- a/src/frontend/src/pages/part/CategoryDetail.tsx +++ b/src/frontend/src/pages/part/CategoryDetail.tsx @@ -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: , hidden: !id || !category.pk, content: diff --git a/src/frontend/src/tables/part/PartCategoryTemplateTable.tsx b/src/frontend/src/tables/part/PartCategoryTemplateTable.tsx index 362c863e23..61fc0e33b9 100644 --- a/src/frontend/src/tables/part/PartCategoryTemplateTable.tsx +++ b/src/frontend/src/tables/part/PartCategoryTemplateTable.tsx @@ -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} + } + title={t`Part Category Parameters Templates`} + > + + {t`Parts which are created within this category will inherit the default values specified here.`} + +