mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add PART_VIRTUAL setting
This commit is contained in:
parent
0aeeba808c
commit
b05504e1c4
@ -153,6 +153,13 @@ class InvenTreeSetting(models.Model):
|
|||||||
'validator': bool,
|
'validator': bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'PART_VIRTUAL': {
|
||||||
|
'name': _('Virtual'),
|
||||||
|
'description': _('Parts are virtual by default'),
|
||||||
|
'default': False,
|
||||||
|
'validator': bool,
|
||||||
|
},
|
||||||
|
|
||||||
'BUILDORDER_REFERENCE_PREFIX': {
|
'BUILDORDER_REFERENCE_PREFIX': {
|
||||||
'name': _('Build Order Reference Prefix'),
|
'name': _('Build Order Reference Prefix'),
|
||||||
'description': _('Prefix value for build order reference'),
|
'description': _('Prefix value for build order reference'),
|
||||||
|
@ -236,6 +236,7 @@ class EditPartForm(HelperForm):
|
|||||||
'trackable',
|
'trackable',
|
||||||
'purchaseable',
|
'purchaseable',
|
||||||
'salable',
|
'salable',
|
||||||
|
'virtual',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
# Generated by Django 3.0.7 on 2021-01-03 12:06
|
# Generated by Django 3.0.7 on 2021-01-03 12:13
|
||||||
|
|
||||||
import InvenTree.fields
|
import InvenTree.fields
|
||||||
import InvenTree.validators
|
import InvenTree.validators
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
import markdownx.models
|
||||||
import mptt.fields
|
import mptt.fields
|
||||||
import part.settings
|
import part.settings
|
||||||
|
|
||||||
@ -61,6 +62,11 @@ class Migration(migrations.Migration):
|
|||||||
name='name',
|
name='name',
|
||||||
field=models.CharField(help_text='Part name', max_length=100, validators=[InvenTree.validators.validate_part_name], verbose_name='Name'),
|
field=models.CharField(help_text='Part name', max_length=100, validators=[InvenTree.validators.validate_part_name], verbose_name='Name'),
|
||||||
),
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='part',
|
||||||
|
name='notes',
|
||||||
|
field=markdownx.models.MarkdownxField(blank=True, help_text='Part notes - supports Markdown formatting', null=True, verbose_name='Notes'),
|
||||||
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='part',
|
model_name='part',
|
||||||
name='revision',
|
name='revision',
|
||||||
@ -71,4 +77,9 @@ class Migration(migrations.Migration):
|
|||||||
name='variant_of',
|
name='variant_of',
|
||||||
field=models.ForeignKey(blank=True, help_text='Is this part a variant of another part?', limit_choices_to={'active': True, 'is_template': True}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='variants', to='part.Part', verbose_name='Variant Of'),
|
field=models.ForeignKey(blank=True, help_text='Is this part a variant of another part?', limit_choices_to={'active': True, 'is_template': True}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='variants', to='part.Part', verbose_name='Variant Of'),
|
||||||
),
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='part',
|
||||||
|
name='virtual',
|
||||||
|
field=models.BooleanField(default=part.settings.part_virtual_default, help_text='Is this a virtual part, such as a software product or license?', verbose_name='Virtual'),
|
||||||
|
),
|
||||||
]
|
]
|
@ -802,11 +802,15 @@ class Part(MPTTModel):
|
|||||||
help_text=_('Is this part active?'))
|
help_text=_('Is this part active?'))
|
||||||
|
|
||||||
virtual = models.BooleanField(
|
virtual = models.BooleanField(
|
||||||
default=False,
|
default=part_settings.part_virtual_default,
|
||||||
verbose_name=_('Virtual'),
|
verbose_name=_('Virtual'),
|
||||||
help_text=_('Is this a virtual part, such as a software product or license?'))
|
help_text=_('Is this a virtual part, such as a software product or license?'))
|
||||||
|
|
||||||
notes = MarkdownxField(blank=True, null=True, help_text=_('Part notes - supports Markdown formatting'))
|
notes = MarkdownxField(
|
||||||
|
blank=True, null=True,
|
||||||
|
verbose_name=_('Notes'),
|
||||||
|
help_text=_('Part notes - supports Markdown formatting')
|
||||||
|
)
|
||||||
|
|
||||||
bom_checksum = models.CharField(max_length=128, blank=True, help_text=_('Stored BOM checksum'))
|
bom_checksum = models.CharField(max_length=128, blank=True, help_text=_('Stored BOM checksum'))
|
||||||
|
|
||||||
|
@ -24,6 +24,14 @@ def part_template_default():
|
|||||||
return InvenTreeSetting.get_setting('PART_TEMPLATE')
|
return InvenTreeSetting.get_setting('PART_TEMPLATE')
|
||||||
|
|
||||||
|
|
||||||
|
def part_virtual_default():
|
||||||
|
"""
|
||||||
|
Returns the default value for the 'is_virtual' field of Part object
|
||||||
|
"""
|
||||||
|
|
||||||
|
return InvenTreeSetting.get_setting('PART_VIRTUAL')
|
||||||
|
|
||||||
|
|
||||||
def part_component_default():
|
def part_component_default():
|
||||||
"""
|
"""
|
||||||
Returns the default value for the 'component' field of a Part object
|
Returns the default value for the 'component' field of a Part object
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
{% include "InvenTree/settings/setting.html" with key="PART_TRACKABLE" icon="fa-directions" %}
|
{% include "InvenTree/settings/setting.html" with key="PART_TRACKABLE" icon="fa-directions" %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="PART_PURCHASEABLE" icon="fa-shopping-cart" %}
|
{% include "InvenTree/settings/setting.html" with key="PART_PURCHASEABLE" icon="fa-shopping-cart" %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="PART_SALABLE" icon="fa-dollar-sign" %}
|
{% include "InvenTree/settings/setting.html" with key="PART_SALABLE" icon="fa-dollar-sign" %}
|
||||||
|
{% include "InvenTree/settings/setting.html" with key="PART_VIRTUAL" icon="fa-ghost" %}
|
||||||
<tr><td colspan='5'></td></tr>
|
<tr><td colspan='5'></td></tr>
|
||||||
{% include "InvenTree/settings/setting.html" with key="PART_COPY_BOM" %}
|
{% include "InvenTree/settings/setting.html" with key="PART_COPY_BOM" %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="PART_COPY_PARAMETERS" %}
|
{% include "InvenTree/settings/setting.html" with key="PART_COPY_PARAMETERS" %}
|
||||||
|
Loading…
Reference in New Issue
Block a user