mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Add 'consumable' field to Part
- Indicates that a part can be used to make other parts - This is the inverse of 'buildable' - Add this field to the serializer and edit forms - Display parameter on part info page - BOM edit window only requests sub-parts that are marked as 'consumable' - Also added option to edit 'units' field for part
This commit is contained in:
parent
ca96c8e22b
commit
6e2b111b9c
@ -107,6 +107,11 @@ class PartList(generics.ListCreateAPIView):
|
|||||||
]
|
]
|
||||||
|
|
||||||
filter_fields = [
|
filter_fields = [
|
||||||
|
'buildable',
|
||||||
|
'consumable',
|
||||||
|
'trackable',
|
||||||
|
'purchaseable',
|
||||||
|
'salable',
|
||||||
]
|
]
|
||||||
|
|
||||||
ordering_fields = [
|
ordering_fields = [
|
||||||
|
@ -48,8 +48,10 @@ class EditPartForm(HelperForm):
|
|||||||
'URL',
|
'URL',
|
||||||
'default_location',
|
'default_location',
|
||||||
'default_supplier',
|
'default_supplier',
|
||||||
|
'units',
|
||||||
'minimum_stock',
|
'minimum_stock',
|
||||||
'buildable',
|
'buildable',
|
||||||
|
'consumable',
|
||||||
'trackable',
|
'trackable',
|
||||||
'purchaseable',
|
'purchaseable',
|
||||||
'salable',
|
'salable',
|
||||||
|
18
InvenTree/part/migrations/0005_part_consumable.py
Normal file
18
InvenTree/part/migrations/0005_part_consumable.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.2 on 2019-04-15 13:48
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('part', '0004_bomitem_note'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='part',
|
||||||
|
name='consumable',
|
||||||
|
field=models.BooleanField(default=False, help_text='Can this part be used to build other parts?'),
|
||||||
|
),
|
||||||
|
]
|
@ -126,9 +126,12 @@ class Part(models.Model):
|
|||||||
# Units of quantity for this part. Default is "pcs"
|
# Units of quantity for this part. Default is "pcs"
|
||||||
units = models.CharField(max_length=20, default="pcs", blank=True)
|
units = models.CharField(max_length=20, default="pcs", blank=True)
|
||||||
|
|
||||||
# Can this part be built?
|
# Can this part be built from other parts?
|
||||||
buildable = models.BooleanField(default=False, help_text='Can this part be built from other parts?')
|
buildable = models.BooleanField(default=False, help_text='Can this part be built from other parts?')
|
||||||
|
|
||||||
|
# Can this part be used to make other parts?
|
||||||
|
consumable = models.BooleanField(default=True, help_text='Can this part be used to build other parts?')
|
||||||
|
|
||||||
# Is this part "trackable"?
|
# Is this part "trackable"?
|
||||||
# Trackable parts can have unique instances
|
# Trackable parts can have unique instances
|
||||||
# which are assigned serial numbers (or batch numbers)
|
# which are assigned serial numbers (or batch numbers)
|
||||||
|
@ -61,6 +61,7 @@ class PartSerializer(serializers.ModelSerializer):
|
|||||||
'units',
|
'units',
|
||||||
'trackable',
|
'trackable',
|
||||||
'buildable',
|
'buildable',
|
||||||
|
'consumable',
|
||||||
'trackable',
|
'trackable',
|
||||||
'salable',
|
'salable',
|
||||||
]
|
]
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Description</td>
|
<td>Description</td>
|
||||||
<td>{{ part.decription }}</td>
|
<td>{{ part.description }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if part.IPN %}
|
{% if part.IPN %}
|
||||||
<tr>
|
<tr>
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<td>Category</td>
|
<td>Category</td>
|
||||||
<td>
|
<td>
|
||||||
{% if part.category %}
|
{% if part.category %}
|
||||||
<a href="{% url 'category-detail' part.category.id %}">{{ part.category.name }}</a>
|
<a href="{% url 'category-detail' part.category.id %}">{{ part.category.pathstring }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -70,6 +70,10 @@
|
|||||||
<td>Buildable</td>
|
<td>Buildable</td>
|
||||||
<td>{% include "yesnolabel.html" with value=part.buildable %}</td>
|
<td>{% include "yesnolabel.html" with value=part.buildable %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Consumable</td>
|
||||||
|
<td>{% include "yesnolabel.html" with value=part.consumable %}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Trackable</td>
|
<td>Trackable</td>
|
||||||
<td>{% include "yesnolabel.html" with value=part.trackable %}</td>
|
<td>{% include "yesnolabel.html" with value=part.trackable %}</td>
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<h4>Stock Status - {{ part.available_stock }} available</h4>
|
<h4>Stock Status - {{ part.available_stock }}{% if part.units %} {{ part.units }} {% endif%} available</h4>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<td>In Stock</td>
|
<td>In Stock</td>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<li{% ifequal tab 'build' %} class="active"{% endifequal %}>
|
<li{% ifequal tab 'build' %} class="active"{% endifequal %}>
|
||||||
<a href="{% url 'part-build' part.id %}">Build<span class='badge'>{{ part.active_builds|length }}</span></a></li>
|
<a href="{% url 'part-build' part.id %}">Build<span class='badge'>{{ part.active_builds|length }}</span></a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if part.used_in_count > 0 %}
|
{% if part.consumable or part.used_in_count > 0 %}
|
||||||
<li{% ifequal tab 'used' %} class="active"{% endifequal %}>
|
<li{% ifequal tab 'used' %} class="active"{% endifequal %}>
|
||||||
<a href="{% url 'part-used-in' part.id %}">Used In{% if part.used_in_count > 0 %}<span class="badge">{{ part.used_in_count }}</span>{% endif %}</a></li>
|
<a href="{% url 'part-used-in' part.id %}">Used In{% if part.used_in_count > 0 %}<span class="badge">{{ part.used_in_count }}</span>{% endif %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user