mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
* improve wording for "Inherited" option of BOM items (#4376) * add migrations
This commit is contained in:
parent
89ac0a623b
commit
efb55c720f
@ -1634,7 +1634,7 @@ class BomFilter(rest_filters.FilterSet):
|
|||||||
# Boolean filters for BOM item
|
# Boolean filters for BOM item
|
||||||
optional = rest_filters.BooleanFilter(label='BOM item is optional')
|
optional = rest_filters.BooleanFilter(label='BOM item is optional')
|
||||||
consumable = rest_filters.BooleanFilter(label='BOM item is consumable')
|
consumable = rest_filters.BooleanFilter(label='BOM item is consumable')
|
||||||
inherited = rest_filters.BooleanFilter(label='BOM item is inherited')
|
inherited = rest_filters.BooleanFilter(label='BOM item gets inherited')
|
||||||
allow_variants = rest_filters.BooleanFilter(label='Variants are allowed')
|
allow_variants = rest_filters.BooleanFilter(label='Variants are allowed')
|
||||||
|
|
||||||
# Filters for linked 'part'
|
# Filters for linked 'part'
|
||||||
|
18
InvenTree/part/migrations/0099_alter_bomitem_inherited.py
Normal file
18
InvenTree/part/migrations/0099_alter_bomitem_inherited.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.2.18 on 2023-02-23 11:53
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('part', '0098_auto_20230214_1115'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='bomitem',
|
||||||
|
name='inherited',
|
||||||
|
field=models.BooleanField(default=False, help_text='This BOM item is inherited by BOMs for variant parts', verbose_name='Gets inherited'),
|
||||||
|
),
|
||||||
|
]
|
@ -3512,7 +3512,7 @@ class BomItem(DataImportMixin, models.Model):
|
|||||||
|
|
||||||
inherited = models.BooleanField(
|
inherited = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
verbose_name=_('Inherited'),
|
verbose_name=_('Gets inherited'),
|
||||||
help_text=_('This BOM item is inherited by BOMs for variant parts'),
|
help_text=_('This BOM item is inherited by BOMs for variant parts'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
<th>{% trans "Reference" %}</th>
|
<th>{% trans "Reference" %}</th>
|
||||||
<th>{% trans "Overage" %}</th>
|
<th>{% trans "Overage" %}</th>
|
||||||
<th>{% trans "Allow Variants" %}</th>
|
<th>{% trans "Allow Variants" %}</th>
|
||||||
<th>{% trans "Inherited" %}</th>
|
<th>{% trans "Gets inherited" %}</th>
|
||||||
<th>{% trans "Optional" %}</th>
|
<th>{% trans "Optional" %}</th>
|
||||||
<th>{% trans "Note" %}</th>
|
<th>{% trans "Note" %}</th>
|
||||||
<th><!-- Buttons Column --></th>
|
<th><!-- Buttons Column --></th>
|
||||||
|
@ -1019,7 +1019,7 @@ function loadBomTable(table, options={}) {
|
|||||||
|
|
||||||
cols.push({
|
cols.push({
|
||||||
field: 'inherited',
|
field: 'inherited',
|
||||||
title: '{% trans "Inherited" %}',
|
title: '{% trans "Gets inherited" %}',
|
||||||
searchable: false,
|
searchable: false,
|
||||||
formatter: function(value, row) {
|
formatter: function(value, row) {
|
||||||
// This BOM item *is* inheritable, but is defined for this BOM
|
// This BOM item *is* inheritable, but is defined for this BOM
|
||||||
@ -1029,10 +1029,7 @@ function loadBomTable(table, options={}) {
|
|||||||
return yesNoLabel(true);
|
return yesNoLabel(true);
|
||||||
} else {
|
} else {
|
||||||
// If this BOM item is inherited from a parent part
|
// If this BOM item is inherited from a parent part
|
||||||
return renderLink(
|
return yesNoLabel(true, {muted: true});
|
||||||
'{% trans "View BOM" %}',
|
|
||||||
`/part/${row.part}/bom/`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -19,12 +19,23 @@
|
|||||||
withTitle,
|
withTitle,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function yesNoLabel(value) {
|
function yesNoLabel(value, options={}) {
|
||||||
|
var text = '';
|
||||||
|
var color = '';
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
return `<span class='badge rounded-pill bg-success'>{% trans "YES" %}</span>`;
|
text = '{% trans "YES" %}';
|
||||||
|
color = 'bg-success';
|
||||||
} else {
|
} else {
|
||||||
return `<span class='badge rounded-pill bg-warning'>{% trans "NO" %}</span>`;
|
text = '{% trans "NO" %}';
|
||||||
|
color = 'bg-warning';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.muted) {
|
||||||
|
color = 'bg-secondary';
|
||||||
|
}
|
||||||
|
|
||||||
|
return `<span class='badge rounded-pill ${color}'>${text}</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ function getAvailableTableFilters(tableKey) {
|
|||||||
},
|
},
|
||||||
inherited: {
|
inherited: {
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
title: '{% trans "Inherited" %}',
|
title: '{% trans "Gets inherited" %}',
|
||||||
},
|
},
|
||||||
allow_variants: {
|
allow_variants: {
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
@ -105,7 +105,7 @@ function getAvailableTableFilters(tableKey) {
|
|||||||
return {
|
return {
|
||||||
'inherited': {
|
'inherited': {
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
title: '{% trans "Inherited" %}',
|
title: '{% trans "Gets inherited" %}',
|
||||||
},
|
},
|
||||||
'optional': {
|
'optional': {
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
|
Loading…
Reference in New Issue
Block a user