mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #874 from SchrodingersGat/show_non_stock
Add ability to display "out of stock" items against a part
This commit is contained in:
commit
da70af7ba0
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
function defaultFilters() {
|
function defaultFilters() {
|
||||||
return {
|
return {
|
||||||
stock: "cascade=1",
|
stock: "cascade=1&in_stock=1",
|
||||||
build: "",
|
build: "",
|
||||||
parts: "cascade=1",
|
parts: "cascade=1",
|
||||||
company: "",
|
company: "",
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
part: {{ part.id }},
|
part: {{ part.id }},
|
||||||
location_detail: true,
|
location_detail: true,
|
||||||
part_detail: true,
|
part_detail: true,
|
||||||
in_stock: true,
|
|
||||||
},
|
},
|
||||||
groupByField: 'location',
|
groupByField: 'location',
|
||||||
buttons: [
|
buttons: [
|
||||||
|
@ -51,15 +51,6 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if part.trackable %}
|
{% if part.trackable %}
|
||||||
{% if 0 %}
|
|
||||||
<!-- TODO - Add the 'tracking' tab back in -->
|
|
||||||
<li{% ifequal tab 'track' %} class="active"{% endifequal %}>
|
|
||||||
<a href="{% url 'part-track' part.id %}">{% trans "Tracking" %}
|
|
||||||
{% if parts.serials.all|length > 0 %}
|
|
||||||
<span class="badge">{{ part.serials.all|length }}</span>
|
|
||||||
{% endif %}
|
|
||||||
</a></li>
|
|
||||||
{% endif %}
|
|
||||||
<li{% ifequal tab 'tests' %} class='active'{% endifequal %}>
|
<li{% ifequal tab 'tests' %} class='active'{% endifequal %}>
|
||||||
<a href='{% url "part-test-templates" part.id %}'>{% trans "Tests" %}
|
<a href='{% url "part-test-templates" part.id %}'>{% trans "Tests" %}
|
||||||
{% if part.getTestTemplates.count > 0 %}<span class='badge'>{{ part.getTestTemplates.count }}</span>{% endif %}
|
{% if part.getTestTemplates.count > 0 %}<span class='badge'>{{ part.getTestTemplates.count }}</span>{% endif %}
|
||||||
|
@ -71,6 +71,7 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
|||||||
'belongs_to',
|
'belongs_to',
|
||||||
'build',
|
'build',
|
||||||
'build_order',
|
'build_order',
|
||||||
|
'customer',
|
||||||
'sales_order',
|
'sales_order',
|
||||||
'supplier_part',
|
'supplier_part',
|
||||||
'supplier_part__supplier',
|
'supplier_part__supplier',
|
||||||
@ -141,6 +142,7 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
|||||||
'batch',
|
'batch',
|
||||||
'build_order',
|
'build_order',
|
||||||
'belongs_to',
|
'belongs_to',
|
||||||
|
'customer',
|
||||||
'in_stock',
|
'in_stock',
|
||||||
'link',
|
'link',
|
||||||
'location',
|
'location',
|
||||||
|
@ -248,7 +248,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
part_detail: true,
|
part_detail: true,
|
||||||
location_detail: true,
|
location_detail: true,
|
||||||
in_stock: true,
|
|
||||||
},
|
},
|
||||||
url: "{% url 'api-stock-list' %}",
|
url: "{% url 'api-stock-list' %}",
|
||||||
});
|
});
|
||||||
|
@ -494,12 +494,17 @@ function loadStockTable(table, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
if (value) {
|
if (value) {
|
||||||
return renderLink(value, '/stock/location/' + row.location + '/');
|
return renderLink(value, `/stock/location/${row.location}/`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (row.customer) {
|
||||||
|
var text = "{% trans "Shipped to customer" %}";
|
||||||
|
return renderLink(text, `/company/${row.customer}/assigned-stock/`);
|
||||||
|
} else {
|
||||||
return '<i>{% trans "No stock location set" %}</i>';
|
return '<i>{% trans "No stock location set" %}</i>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'notes',
|
field: 'notes',
|
||||||
|
@ -14,6 +14,11 @@ function getAvailableTableFilters(tableKey) {
|
|||||||
// Filters for the "Stock" table
|
// Filters for the "Stock" table
|
||||||
if (tableKey == 'stock') {
|
if (tableKey == 'stock') {
|
||||||
return {
|
return {
|
||||||
|
in_stock: {
|
||||||
|
type: 'bool',
|
||||||
|
title: '{% trans "In Stock" %}',
|
||||||
|
description: '{% trans "Show items which are in stock" %}',
|
||||||
|
},
|
||||||
cascade: {
|
cascade: {
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
title: '{% trans "Include sublocations" %}',
|
title: '{% trans "Include sublocations" %}',
|
||||||
|
Loading…
Reference in New Issue
Block a user