mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-16 17:28:11 +00:00
Add "enabled" field to ParameterTemplate model
This commit is contained in:
@@ -773,7 +773,7 @@ class ParameterTemplateFilter(FilterSet):
|
|||||||
"""Metaclass options."""
|
"""Metaclass options."""
|
||||||
|
|
||||||
model = common.models.ParameterTemplate
|
model = common.models.ParameterTemplate
|
||||||
fields = ['model_type', 'name', 'units', 'checkbox']
|
fields = ['model_type', 'name', 'units', 'checkbox', 'enabled']
|
||||||
|
|
||||||
has_choices = rest_filters.BooleanFilter(
|
has_choices = rest_filters.BooleanFilter(
|
||||||
method='filter_has_choices', label='Has Choice'
|
method='filter_has_choices', label='Has Choice'
|
||||||
|
|||||||
@@ -108,6 +108,14 @@ class Migration(migrations.Migration):
|
|||||||
verbose_name="Selection List",
|
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),
|
bases=(InvenTree.models.PluginValidationMixin, models.Model),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -2377,6 +2377,7 @@ class ParameterTemplate(
|
|||||||
checkbox: Is this template a checkbox (boolean) type?
|
checkbox: Is this template a checkbox (boolean) type?
|
||||||
choices: Comma-separated list of choices (if applicable)
|
choices: Comma-separated list of choices (if applicable)
|
||||||
selectionlist: Optional link to a SelectionList for this template
|
selectionlist: Optional link to a SelectionList for this template
|
||||||
|
enabled: Is this template enabled?
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -2523,6 +2524,12 @@ class ParameterTemplate(
|
|||||||
help_text=_('Selection list for this parameter'),
|
help_text=_('Selection list for this parameter'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
enabled = models.BooleanField(
|
||||||
|
default=True,
|
||||||
|
verbose_name=_('Enabled'),
|
||||||
|
help_text=_('Is this parameter template enabled?'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Parameter(
|
class Parameter(
|
||||||
UpdatedUserMixin, InvenTree.models.MetadataMixin, InvenTree.models.InvenTreeModel
|
UpdatedUserMixin, InvenTree.models.MetadataMixin, InvenTree.models.InvenTreeModel
|
||||||
|
|||||||
@@ -191,8 +191,8 @@ export default function AdminCenter() {
|
|||||||
content: <UnitManagementPanel />
|
content: <UnitManagementPanel />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'part-parameters',
|
name: 'parameters',
|
||||||
label: t`Part Parameters`,
|
label: t`Parameters`,
|
||||||
icon: <IconList />,
|
icon: <IconList />,
|
||||||
content: <PartParameterPanel />,
|
content: <PartParameterPanel />,
|
||||||
hidden: !user.hasViewRole(UserRoles.part)
|
hidden: !user.hasViewRole(UserRoles.part)
|
||||||
@@ -274,7 +274,7 @@ export default function AdminCenter() {
|
|||||||
id: 'plm',
|
id: 'plm',
|
||||||
label: t`PLM`,
|
label: t`PLM`,
|
||||||
panelIDs: [
|
panelIDs: [
|
||||||
'part-parameters',
|
'parameters',
|
||||||
'category-parameters',
|
'category-parameters',
|
||||||
'location-types',
|
'location-types',
|
||||||
'stocktake'
|
'stocktake'
|
||||||
|
|||||||
@@ -147,6 +147,11 @@ export default function ParameterTemplateTable() {
|
|||||||
label: t`Has Units`,
|
label: t`Has Units`,
|
||||||
description: t`Show templates with units`
|
description: t`Show templates with units`
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'enabled',
|
||||||
|
label: t`Enabled`,
|
||||||
|
description: t`Show enabled templates`
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'model_type',
|
name: 'model_type',
|
||||||
label: t`Model Type`,
|
label: t`Model Type`,
|
||||||
@@ -176,7 +181,10 @@ export default function ParameterTemplateTable() {
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
accessor: 'choices'
|
accessor: 'choices'
|
||||||
}
|
},
|
||||||
|
BooleanColumn({
|
||||||
|
accessor: 'enabled'
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user