[BUG] Exception thrown when opening part "'NoneType' object has no attribute 'strftime'"
<!---
Everything inside these brackets is hidden - please remove them where you fill out information.
--->


I entered a new part yesterday, complete with picture and all. Attached it to an order, and issued the order.
I.e. on all accounts the part was fine yesterday.
I started the server again today, and now opening the part overview page, I get "'NoneType' object has no attribute 'strftime'".
I have attached the traceback.

I can open the part in the admin site. There it looks fine.
 I tried updating an attribute on the part there and save, but it didn't resolve the issue.

How the part got into this state, I don't know. Unfortunately, I can't retrace the steps I may have done to cause this issue.

I'm running the main branch on bare metal.

[traceback.txt](https://github.com/inventree/InvenTree/files/7627107/traceback.txt)



diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py
index cd9ea6b41..6e742dc57 100644
--- a/InvenTree/part/views.py
+++ b/InvenTree/part/views.py
@@ -439,10 +439,14 @@ class PartDetail(InvenTreeRoleMixin, DetailView):
                         line['price_part'] = stock_item.supplier_part.unit_pricing
 
                 # set date for graph labels
-                if stock_item.purchase_order:
+                if stock_item.purchase_order and stock_item.purchase_order.issue_date:
                     line['date'] = stock_item.purchase_order.issue_date.strftime('%d.%m.%Y')
-                else:
+                elif stock_item.tracking_info.count() > 0:
                     line['date'] = stock_item.tracking_info.first().date.strftime('%d.%m.%Y')
+                else:
+                    # Not enough information
+                    continue
+
                 price_history.append(line)
 
             ctx['price_history'] = price_history
['InvenTree/part/views.py']