From 6f00c662a1c0320e9f8fd71ed3a11f02610a31b2 Mon Sep 17 00:00:00 2001
From: Nigel <nigel.w@nosun.ca>
Date: Thu, 15 Apr 2021 16:28:50 -0600
Subject: [PATCH] fix: don't link manufacturer part if it doesn't have one

---
 InvenTree/order/templates/order/purchase_order_detail.html | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html
index c28f383a9d..93b7ffbd8e 100644
--- a/InvenTree/order/templates/order/purchase_order_detail.html
+++ b/InvenTree/order/templates/order/purchase_order_detail.html
@@ -182,7 +182,11 @@ $("#po-table").inventreeTable({
             field: 'supplier_part_detail.MPN',
             title: '{% trans "MPN" %}',
             formatter: function(value, row, index, field) {
-                return renderLink(value, `/manufacturer-part/${row.supplier_part_detail.manufacturer_part.pk}/`);
+                if (row.supplier_part_detail.manufacturer_part) {
+                    return renderLink(value, `/manufacturer-part/${row.supplier_part_detail.manufacturer_part.pk}/`);
+                } else {
+                    return "";
+                }
             },
         },
         {