diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index 9746103c89..2e1ec0c39c 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -179,7 +179,11 @@ $("#po-table").inventreeTable({ field: 'supplier_part_detail.SKU', title: '{% trans "SKU" %}', formatter: function(value, row, index, field) { - return renderLink(value, `/supplier-part/${row.part}/`); + if (value) { + return renderLink(value, `/supplier-part/${row.part}/`); + } else { + return '-'; + } }, }, { @@ -188,7 +192,7 @@ $("#po-table").inventreeTable({ field: 'supplier_part_detail.MPN', title: '{% trans "MPN" %}', formatter: function(value, row, index, field) { - if (row.supplier_part_detail.manufacturer_part) { + if (row.supplier_part_detail && row.supplier_part_detail.manufacturer_part) { return renderLink(value, `/manufacturer-part/${row.supplier_part_detail.manufacturer_part.pk}/`); } else { return ""; diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index 948c0ff768..524b116743 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -696,7 +696,14 @@ function loadStockTable(table, options) { } var link = `/supplier-part/${row.supplier_part}/stock/`; - var text = `${row.supplier_part_detail.SKU}`; + + var text = ''; + + if (row.supplier_part_detail) { + text = `${row.supplier_part_detail.SKU}`; + } else { + text = `{% trans "Supplier part not specified" %}`; + } return renderLink(text, link); }