From 771f6de93a26b7c38a85b6cb280c29e49e09c863 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 17 Mar 2022 23:56:48 +0100 Subject: [PATCH 1/2] [BUG] ValueError on Part page Fixes #2756 --- InvenTree/part/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 4b1e0eca33..e3006ff525 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -441,9 +441,9 @@ class PartDetail(InvenTreeRoleMixin, DetailView): # set date for graph labels if stock_item.purchase_order and stock_item.purchase_order.issue_date: - line['date'] = stock_item.purchase_order.issue_date.strftime('%d.%m.%Y') + line['date'] = stock_item.purchase_order.issue_date.isoformat() elif stock_item.tracking_info.count() > 0: - line['date'] = stock_item.tracking_info.first().date.strftime('%d.%m.%Y') + line['date'] = stock_item.tracking_info.first().date.isoformat() else: # Not enough information continue @@ -500,9 +500,9 @@ class PartDetail(InvenTreeRoleMixin, DetailView): # set date for graph labels if sale_item.order.issue_date: - line['date'] = sale_item.order.issue_date.strftime('%d.%m.%Y') + line['date'] = sale_item.order.issue_date.isoformat() elif sale_item.order.creation_date: - line['date'] = sale_item.order.creation_date.strftime('%d.%m.%Y') + line['date'] = sale_item.order.creation_date.isoformat() else: line['date'] = _('None') From 927f7bbdad7da124cf1be4b7f5bfa227a5de446c Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 18 Mar 2022 00:05:12 +0100 Subject: [PATCH 2/2] only render it as a date --- InvenTree/part/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index e3006ff525..fb45db8f07 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -443,7 +443,7 @@ class PartDetail(InvenTreeRoleMixin, DetailView): if stock_item.purchase_order and stock_item.purchase_order.issue_date: line['date'] = stock_item.purchase_order.issue_date.isoformat() elif stock_item.tracking_info.count() > 0: - line['date'] = stock_item.tracking_info.first().date.isoformat() + line['date'] = stock_item.tracking_info.first().date.date().isoformat() else: # Not enough information continue