mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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 = [
|
||||
'buildable',
|
||||
'consumable',
|
||||
'trackable',
|
||||
'purchaseable',
|
||||
'salable',
|
||||
]
|
||||
|
||||
ordering_fields = [
|
||||
|
@ -48,8 +48,10 @@ class EditPartForm(HelperForm):
|
||||
'URL',
|
||||
'default_location',
|
||||
'default_supplier',
|
||||
'units',
|
||||
'minimum_stock',
|
||||
'buildable',
|
||||
'consumable',
|
||||
'trackable',
|
||||
'purchaseable',
|
||||
'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 = 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?')
|
||||
|
||||
# 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"?
|
||||
# Trackable parts can have unique instances
|
||||
# which are assigned serial numbers (or batch numbers)
|
||||
|
@ -61,6 +61,7 @@ class PartSerializer(serializers.ModelSerializer):
|
||||
'units',
|
||||
'trackable',
|
||||
'buildable',
|
||||
'consumable',
|
||||
'trackable',
|
||||
'salable',
|
||||
]
|
||||
|
@ -32,7 +32,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>{{ part.decription }}</td>
|
||||
<td>{{ part.description }}</td>
|
||||
</tr>
|
||||
{% if part.IPN %}
|
||||
<tr>
|
||||
@ -44,7 +44,7 @@
|
||||
<td>Category</td>
|
||||
<td>
|
||||
{% 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 %}
|
||||
</td>
|
||||
</tr>
|
||||
@ -70,6 +70,10 @@
|
||||
<td>Buildable</td>
|
||||
<td>{% include "yesnolabel.html" with value=part.buildable %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Consumable</td>
|
||||
<td>{% include "yesnolabel.html" with value=part.consumable %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Trackable</td>
|
||||
<td>{% include "yesnolabel.html" with value=part.trackable %}</td>
|
||||
|
@ -37,7 +37,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<tr>
|
||||
<td>In Stock</td>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<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>
|
||||
{% endif %}
|
||||
{% if part.used_in_count > 0 %}
|
||||
{% if part.consumable or part.used_in_count > 0 %}
|
||||
<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>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user