mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Adds more context data
This commit is contained in:
parent
28c9c80f54
commit
34df19242c
@ -119,18 +119,18 @@
|
||||
<td>
|
||||
<h4>{% trans "Available Stock" %}</h4>
|
||||
</td>
|
||||
<td><h4>{% decimal part.available_stock %}{% if part.units %} {{ part.units }}{% endif %}</h4></td>
|
||||
<td><h4>{% decimal available %}{% if part.units %} {{ part.units }}{% endif %}</h4></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-map-marker-alt'></span></td>
|
||||
<td>{% trans "In Stock" %}</td>
|
||||
<td>{% include "part/stock_count.html" %}</td>
|
||||
</tr>
|
||||
{% if part.on_order > 0 %}
|
||||
{% if on_order > 0 %}
|
||||
<tr>
|
||||
<td><span class='fas fa-shopping-cart'></span></td>
|
||||
<td>{% trans "On Order" %}</td>
|
||||
<td>{% decimal part.on_order %}</td>
|
||||
<td>{% decimal on_order %}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if required > 0 %}
|
||||
|
@ -1,10 +1,10 @@
|
||||
{% load inventree_extras %}
|
||||
{% load i18n %}
|
||||
|
||||
{% decimal part.total_stock %}
|
||||
{% decimal total_stock %}
|
||||
|
||||
{% if part.total_stock == 0 %}
|
||||
{% if total_stock == 0 %}
|
||||
<span class='label label-danger label-right'>{% trans "No Stock" %}</span>
|
||||
{% elif part.total_stock < part.minimum_stock %}
|
||||
{% elif total_stock < part.minimum_stock %}
|
||||
<span class='label label-warning label-right'>{% trans "Low Stock" %}</span>
|
||||
{% endif %}
|
@ -15,12 +15,12 @@
|
||||
{% endif %}
|
||||
{% if not part.virtual %}
|
||||
<li{% ifequal tab 'stock' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-stock' part.id %}">{% trans "Stock" %} <span class="badge">{% decimal part.total_stock %}</span></a>
|
||||
<a href="{% url 'part-stock' part.id %}">{% trans "Stock" %} <span class="badge">{% decimal total_stock %}</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if part.component or part.salable or part.used_in_count > 0 %}
|
||||
<li{% ifequal tab 'allocation' %} class="active"{% endifequal %}>
|
||||
<a href="{% url 'part-allocation' part.id %}">{% trans "Allocated" %} <span class="badge">{% decimal part.allocation_count %}</span></a>
|
||||
<a href="{% url 'part-allocation' part.id %}">{% trans "Allocated" %} <span class="badge">{% decimal allocated %}</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if part.assembly %}
|
||||
|
@ -793,12 +793,18 @@ class PartDetail(InvenTreeRoleMixin, DetailView):
|
||||
context['disabled'] = not part.active
|
||||
|
||||
# Pre-calculate complex queries so they only need to be performed once
|
||||
context['total_stock'] = part.total_stock
|
||||
|
||||
context['quantity_being_built'] = part.quantity_being_built
|
||||
|
||||
context['required_build_order_quantity'] = part.required_build_order_quantity()
|
||||
context['allocated_build_order_quantity'] = part.build_order_allocation_count()
|
||||
|
||||
context['required_sales_order_quantity'] = part.required_sales_order_quantity()
|
||||
context['allocated_sales_order_quantity'] = part.sales_order_allocation_count()
|
||||
|
||||
context['available'] = part.available_stock
|
||||
context['on_order'] = part.on_order
|
||||
context['required'] = context['required_build_order_quantity'] + context['required_sales_order_quantity']
|
||||
context['allocated'] = context['allocated_build_order_quantity'] + context['allocated_sales_order_quantity']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user