mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-14 15:41:10 +00:00
Parts now know how many builds they are allocated to
- allocated_builds returns lists of active builds this part is allocated to - allocated_build_count returns the total number of this part allocated to builds - allocation_count returns total number of allocated parts (in the future this will also include those parts allocated to customer orders)
This commit is contained in:
29
InvenTree/part/templates/part/allocation.html
Normal file
29
InvenTree/part/templates/part/allocation.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{% extends "part/part_base.html" %}
|
||||
|
||||
{% block details %}
|
||||
|
||||
{% include "part/tabs.html" with tab="allocation" %}
|
||||
|
||||
<h3>Part Allocation</h3>
|
||||
|
||||
{% if part.allocated_build_count > 0 %}
|
||||
<h4>Allocated to Part Builds</h4>
|
||||
<table class='table table-striped'>
|
||||
<tr>
|
||||
<th>Build</th>
|
||||
<th>Making</th>
|
||||
<th>Allocted</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
{% for build in part.allocated_builds %}
|
||||
<tr>
|
||||
<td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td>
|
||||
<td><a href="{% url 'part-detail' build.part.id %}">{{ build.part.name }}</a></td>
|
||||
<td>Quantity</td>
|
||||
<td>{% include "part/build_status.html" with build=build %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
@@ -3,18 +3,8 @@
|
||||
<td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td>
|
||||
<td>{{ build.quantity }}</td>
|
||||
<td>
|
||||
{% if build.status == build.PENDING %}
|
||||
<span class='label label-info'>
|
||||
{% elif build.status == build.HOLDING %}
|
||||
<span class='label label-warning'>
|
||||
{% elif build.status == build.CANCELLED %}
|
||||
<span class='label label-danger'>
|
||||
{% elif build.status == build.COMPLETE %}
|
||||
<span class='label label-success'>
|
||||
{% endif %}
|
||||
{{ build.get_status_display }}
|
||||
</span>
|
||||
{% include "part/build_status.html" with build=build %}
|
||||
</td>
|
||||
<td>{{ build.completion_date }}</td>
|
||||
<td>{% if build.completion_date %}{{ build.completion_date }}{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
11
InvenTree/part/templates/part/build_status.html
Normal file
11
InvenTree/part/templates/part/build_status.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% if build.status == build.PENDING %}
|
||||
<span class='label label-info'>
|
||||
{% elif build.status == build.HOLDING %}
|
||||
<span class='label label-warning'>
|
||||
{% elif build.status == build.CANCELLED %}
|
||||
<span class='label label-danger'>
|
||||
{% elif build.status == build.COMPLETE %}
|
||||
<span class='label label-success'>
|
||||
{% endif %}
|
||||
{{ build.get_status_display }}
|
||||
</span>
|
@@ -22,11 +22,6 @@
|
||||
{% if part.description %}
|
||||
<p><i>{{ part.description }}</i></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<table class="table table-striped">
|
||||
{% if part.IPN %}
|
||||
<tr>
|
||||
<td>IPN</td>
|
||||
@@ -39,15 +34,22 @@
|
||||
<td><a href="{{ part.URL }}">{{ part.URL }}</a></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<h4>Stock Status - {{ part.available_stock }} available</h4>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<td>Available Stock</td>
|
||||
<td>In Stock</td>
|
||||
<td>
|
||||
{% if part.available_stock == 0 %}
|
||||
<span class='label label-danger'>{{ part.available_stock }}</span>
|
||||
{% elif part.available_stock < part.minimum_stock %}
|
||||
<span class='label label-warning'>{{ part.available_stock }}</span>
|
||||
{% if part.stock == 0 %}
|
||||
<span class='label label-danger'>{{ part.total_stock }}</span>
|
||||
{% elif part.stock < part.minimum_stock %}
|
||||
<span class='label label-warning'>{{ part.total_stock }}</span>
|
||||
{% else %}
|
||||
{{ part.available_stock }}
|
||||
{{ part.total_stock }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -62,6 +64,23 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% if part.quantity_being_built > 0 %}
|
||||
<tr>
|
||||
<td>Underway</td>
|
||||
<td>{{ part.quantity_being_built }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if part.allocation_count > 0 %}
|
||||
<tr>
|
||||
<td>Allocated</td>
|
||||
{% if part.allocation_count > part.total_stock %}
|
||||
<td><span class='label label-danger'>{{ part.allocation_count }}</span>
|
||||
{% else %}
|
||||
{{ part.allocation_count }} {{ part.total_stock }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
</div>
|
||||
|
@@ -7,7 +7,10 @@
|
||||
{% if 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 %}
|
||||
<li{% ifequal tab 'stock' %} class="active"{% endifequal %}><a href="{% url 'part-stock' part.id %}">Stock <span class="badge">{{ part.available_stock }}</span></a></li>
|
||||
<li{% ifequal tab 'stock' %} class="active"{% endifequal %}><a href="{% url 'part-stock' part.id %}">Stock <span class="badge">{{ part.total_stock }}</span></a></li>
|
||||
{% if part.allocation_count > 0 %}
|
||||
<li{% ifequal tab 'allocation' %} class="active"{% endifequal %}><a href="{% url 'part-allocation' part.id %}">Allocated <span class="badge">{{ part.allocation_count }}</span></a></li>
|
||||
{% endif %}
|
||||
{% if part.purchaseable %}
|
||||
<li{% ifequal tab 'suppliers' %} class="active"{% endifequal %}><a href="{% url 'part-suppliers' part.id %}">Suppliers
|
||||
<span class="badge">{{ part.supplier_count }}<span>
|
||||
|
@@ -9,11 +9,13 @@
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Part</th>
|
||||
<th>Uses</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
{% for item in part.used_in.all %}
|
||||
<tr>
|
||||
<td><a href="{% url 'part-bom' item.part.id %}">{{ item.part.name }}</a></td>
|
||||
<td>{{ item.quantity }}</td>
|
||||
<td>{{ item.part.description }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
Reference in New Issue
Block a user