Display more units (#3664)

* <

* Display units in "used in" table

* Display units in BOM table

* Include units in the 'available' column of BOM table
This commit is contained in:
Oliver 2022-09-08 16:26:07 +10:00 committed by GitHub
parent 875dda7e59
commit c4db308dce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -205,7 +205,7 @@
<tr>
<td><span class='fas fa-shopping-cart'></span></td>
<td>{% trans "On Order" %}</td>
<td>{% decimal on_order %} {% include "part/part_units.html" %}/td>
<td>{% decimal on_order %} {% include "part/part_units.html" %}</td>
</tr>
{% endif %}
{% if part.component %}

View File

@ -868,6 +868,10 @@ function loadBomTable(table, options={}) {
// Let's make it a bit more pretty
text = parseFloat(text);
if (row.sub_part_detail && row.sub_part_detail.units) {
text += ` <small>${row.sub_part_detail.units}</small>`;
}
if (row.optional) {
text += ' ({% trans "Optional" %})';
}
@ -923,6 +927,10 @@ function loadBomTable(table, options={}) {
var text = `${available_stock}`;
if (row.sub_part_detail && row.sub_part_detail.units) {
text += ` <small>${row.sub_part_detail.units}</small>`;
}
if (available_stock <= 0) {
text += `<span class='fas fa-times-circle icon-red float-right' title='{% trans "No Stock Available" %}'></span>`;
} else {
@ -1482,6 +1490,10 @@ function loadUsedInTable(table, part_id, options={}) {
formatter: function(value, row) {
var html = value;
if (row.sub_part_detail && row.sub_part_detail.units) {
html += ` <small>${row.sub_part_detail.units}</small>`;
}
if (row.parent && row.parent != 'top-level-item') {
html += ` <em>({% trans "Inherited from parent BOM" %})</em>`;
}