2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-14 07:31:10 +00:00

Function to calculate how many parts can be made with current stock

This commit is contained in:
Oliver
2018-04-16 21:49:38 +10:00
parent 202a8e65b9
commit e43439ef5b
5 changed files with 49 additions and 13 deletions

View File

@@ -15,7 +15,7 @@
<tr>
<td><a href="{% url 'part-detail' sub_part.id %}">{{ sub_part.name }}</a></td>
<td>{{ sub_part.description }}</td>
<td>{{ bom_item.quantity }}</td>
<td>{{ bom_item.quantity }}<span class='badge'>{{ bom_item.sub_part.available_stock }}</span></td>
</tr>
{% endwith %}
{% endfor %}

View File

@@ -7,8 +7,8 @@
{% block del_body %}
{% if part.usedInCount > 0 %}
<p>This part is used in BOMs for {{ part.usedInCount }} other parts. If you delete this part, the BOMs for the following parts will be updated:
{% if part.used_in_count %}
<p>This part is used in BOMs for {{ part.used_in_count }} other parts. If you delete this part, the BOMs for the following parts will be updated:
<ul class="list-group">
{% for child in part.used_in.all %}
<li class='list-group-item'>{{ child.part.name }} - {{ child.part.description }}</li>

View File

@@ -40,9 +40,15 @@
</tr>
{% endif %}
<tr>
<td>Stock</td>
<td>{{ part.stock }}</td>
<td>Available Stock</td>
<td>{{ part.available_stock }}</td>
</tr>
{% if part.has_bom %}
<tr>
<td>Can Build</td>
<td>{{ part.can_build }}</td>
</tr>
{% endif %}
</table>
</div>
</div>

View File

@@ -1,11 +1,11 @@
<ul class="nav nav-tabs">
<li{% ifequal tab 'detail' %} class="active"{% endifequal %}><a href="{% url 'part-detail' part.id %}">Details</a></li>
<li{% ifequal tab 'bom' %} class="active"{% endifequal %}><a href="{% url 'part-bom' part.id %}">BOM{% if part.bomItemCount > 0 %}<span class="badge">{{ part.bomItemCount }}</span>{% endif %}</a></li>
{% if part.bomItemCount > 0 %}
<li{% ifequal tab 'bom' %} class="active"{% endifequal %}><a href="{% url 'part-bom' part.id %}">BOM{% if part.has_bom > 0 %}<span class="badge">{{ part.bom_item_cout }}</span>{% endif %}</a></li>
{% if part.has_bom %}
<li{% ifequal tab 'build' %} class "active"{% endifequal %}><a href="#">Build</a></li>
{% endif %}
{% if part.usedInCount > 0 %}
<li{% ifequal tab 'used' %} class="active"{% endifequal %}><a href="{% url 'part-used-in' part.id %}">Used In{% if part.usedInCount > 0 %}<span class="badge">{{ part.usedInCount }}</span>{% endif %}</a></li>
{% 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.stock }}</span></a></li>
{% if part.purchaseable %}