2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Null units fix (#3663)

* Hide units on part page if units are null

* Hide null units in stock table

* Hide null units in supplier part table

* Hide null units in part tables

* Template cleanup

* Unit test fix
This commit is contained in:
Oliver
2022-09-08 15:18:43 +10:00
committed by GitHub
parent b827f14bf6
commit 875dda7e59
10 changed files with 22 additions and 23 deletions

View File

@ -187,7 +187,7 @@
<tr>
<td><h5><span class='fas fa-boxes'></span></h5></td>
<td><h5>{% trans "Available Stock" %}</h5></td>
<td><h5>{% decimal available %}{% if part.units %} {{ part.units }}{% endif %}</h5></td>
<td><h5>{% decimal available %} {% include "part/part_units.html" %}</h5></td>
</tr>
<tr>
<td><span class='fas fa-map-marker-alt'></span></td>
@ -198,14 +198,14 @@
<tr>
<td><span class='fas fa-flag'></span></td>
<td>{% trans "Minimum Stock" %}</td>
<td>{{ part.minimum_stock }} {{ part.units }}</td>
<td>{{ part.minimum_stock }} {% include "part/part_units.html" %}</td>
</tr>
{% endif %}
{% if on_order > 0 %}
<tr>
<td><span class='fas fa-shopping-cart'></span></td>
<td>{% trans "On Order" %}</td>
<td>{% decimal on_order %} {{ part.units }}</td>
<td>{% decimal on_order %} {% include "part/part_units.html" %}/td>
</tr>
{% endif %}
{% if part.component %}

View File

@ -0,0 +1 @@
{% if part.units %}{{ part.units }}{% endif %}

View File

@ -1,7 +1,7 @@
{% load inventree_extras %}
{% load i18n %}
{% decimal total_stock %} {{ part.units }}
{% decimal total_stock %} {% include "part/part_units.html" %}
{% if total_stock == 0 %}
<span class='badge badge-right rounded-pill bg-danger'>{% trans "No Stock" %}</span>