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."""
|
||||
|
||||
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'
|
||||
|
||||
@@ -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),
|
||||
),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
})
|
||||
];
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user