From c92bb78ae845b9121cd7aad8b009c876edf4ff8e Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 26 May 2020 12:06:38 +1000 Subject: [PATCH] Stock table display fixes --- InvenTree/templates/js/stock.html | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/InvenTree/templates/js/stock.html b/InvenTree/templates/js/stock.html index fd2dd61746..c0737dc250 100644 --- a/InvenTree/templates/js/stock.html +++ b/InvenTree/templates/js/stock.html @@ -337,12 +337,21 @@ function loadStockTable(table, options) { } else { return '-'; } - } else if (field == 'location__path') { + } else if (field == 'location_detail.pathstring') { /* Determine how many locations */ var locations = []; data.forEach(function(item) { - var loc = item.location; + + var loc = null; + + if (item.location_detail) { + loc = item.location_detail.pathstring; + } else { + loc = "{% trans "Undefined location" %}"; + } + + console.log("Location: " + loc); if (!locations.includes(loc)) { locations.push(loc); @@ -353,7 +362,11 @@ function loadStockTable(table, options) { return "In " + locations.length + " locations"; } else { // A single location! - return renderLink(row.location__path, '/stock/location/' + row.location + '/') + if (row.location_detail) { + return renderLink(row.location_detail.pathstring, `/stock/location/${row.location}/`); + } else { + return "{% trans "Undefined location" %}"; + } } } else if (field == 'notes') { var notes = [];