mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #981 from wolffam/build-allocated-no-location-fix
Handle situation where allocated items within a build do not have a location set
This commit is contained in:
commit
25e73db455
@ -50,6 +50,15 @@ InvenTree | Allocate Parts
|
|||||||
return {{ build.quantity }} * row.quantity - sumAllocations(row);
|
return {{ build.quantity }} * row.quantity - sumAllocations(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setExpandedAllocatedLocation(row) {
|
||||||
|
// Handle case when stock item does not have a location set
|
||||||
|
if (row.location_detail == null) {
|
||||||
|
return 'No stock location set';
|
||||||
|
} else {
|
||||||
|
return row.location_detail.pathstring;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function reloadTable() {
|
function reloadTable() {
|
||||||
// Reload the build allocation table
|
// Reload the build allocation table
|
||||||
buildTable.bootstrapTable('refresh');
|
buildTable.bootstrapTable('refresh');
|
||||||
@ -76,7 +85,7 @@ InvenTree | Allocate Parts
|
|||||||
{
|
{
|
||||||
field: 'stock_item',
|
field: 'stock_item',
|
||||||
label: '{% trans "New Stock Item" %}',
|
label: '{% trans "New Stock Item" %}',
|
||||||
title: '{% trans "Create new Stock Item"',
|
title: '{% trans "Create new Stock Item" %}',
|
||||||
url: '{% url "stock-item-create" %}',
|
url: '{% url "stock-item-create" %}',
|
||||||
data: {
|
data: {
|
||||||
part: row.sub_part,
|
part: row.sub_part,
|
||||||
@ -146,7 +155,7 @@ InvenTree | Allocate Parts
|
|||||||
|
|
||||||
subTable.bootstrapTable({
|
subTable.bootstrapTable({
|
||||||
data: row.allocations,
|
data: row.allocations,
|
||||||
showHeader: false,
|
showHeader: true,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
width: '50%',
|
width: '50%',
|
||||||
@ -177,7 +186,7 @@ InvenTree | Allocate Parts
|
|||||||
title: '{% trans "Location" %}',
|
title: '{% trans "Location" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
{% if build.status == BuildStatus.COMPLETE %}
|
{% if build.status == BuildStatus.COMPLETE %}
|
||||||
var text = row.location_detail.pathstring;
|
var text = setExpandedAllocatedLocation(row);
|
||||||
var url = `/stock/location/${row.location}/`;
|
var url = `/stock/location/${row.location}/`;
|
||||||
{% else %}
|
{% else %}
|
||||||
var text = row.stock_item_detail.location_name;
|
var text = row.stock_item_detail.location_name;
|
||||||
|
Loading…
Reference in New Issue
Block a user