2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-12-16 09:18:10 +00:00

Add "enabled" field to ParameterTemplate model

This commit is contained in:
Oliver Walters
2025-11-23 11:59:31 +00:00
parent f743023c83
commit 3c03727500
5 changed files with 28 additions and 5 deletions

View File

@@ -773,7 +773,7 @@ class ParameterTemplateFilter(FilterSet):
"""Metaclass options."""
model = common.models.ParameterTemplate
fields = ['model_type', 'name', 'units', 'checkbox']
fields = ['model_type', 'name', 'units', 'checkbox', 'enabled']
has_choices = rest_filters.BooleanFilter(
method='filter_has_choices', label='Has Choice'

View File

@@ -108,6 +108,14 @@ class Migration(migrations.Migration):
verbose_name="Selection List",
),
),
(
"enabled",
models.BooleanField(
default=True,
help_text="Is this parameter template enabled?",
verbose_name="Enabled",
),
)
],
bases=(InvenTree.models.PluginValidationMixin, models.Model),
),

View File

@@ -2377,6 +2377,7 @@ class ParameterTemplate(
checkbox: Is this template a checkbox (boolean) type?
choices: Comma-separated list of choices (if applicable)
selectionlist: Optional link to a SelectionList for this template
enabled: Is this template enabled?
"""
class Meta:
@@ -2523,6 +2524,12 @@ class ParameterTemplate(
help_text=_('Selection list for this parameter'),
)
enabled = models.BooleanField(
default=True,
verbose_name=_('Enabled'),
help_text=_('Is this parameter template enabled?'),
)
class Parameter(
UpdatedUserMixin, InvenTree.models.MetadataMixin, InvenTree.models.InvenTreeModel

View File

@@ -191,8 +191,8 @@ export default function AdminCenter() {
content: <UnitManagementPanel />
},
{
name: 'part-parameters',
label: t`Part Parameters`,
name: 'parameters',
label: t`Parameters`,
icon: <IconList />,
content: <PartParameterPanel />,
hidden: !user.hasViewRole(UserRoles.part)
@@ -274,7 +274,7 @@ export default function AdminCenter() {
id: 'plm',
label: t`PLM`,
panelIDs: [
'part-parameters',
'parameters',
'category-parameters',
'location-types',
'stocktake'

View File

@@ -147,6 +147,11 @@ export default function ParameterTemplateTable() {
label: t`Has Units`,
description: t`Show templates with units`
},
{
name: 'enabled',
label: t`Enabled`,
description: t`Show enabled templates`
},
{
name: 'model_type',
label: t`Model Type`,
@@ -176,7 +181,10 @@ export default function ParameterTemplateTable() {
}),
{
accessor: 'choices'
}
},
BooleanColumn({
accessor: 'enabled'
})
];
}, []);