From 4462b1e25064a0bca7ac4c415d57e30f8d3cb023 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 27 Jun 2021 21:31:34 +0200 Subject: [PATCH] order stock histroy items --- InvenTree/part/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index cb89f67de3..7a683a29b5 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -984,8 +984,8 @@ class PartPricingView(PartDetail): # Stock history if part.total_stock > 1: price_history = [] - stock = part.stock_entries(include_variants=False, in_stock=True) # .order_by('purchase_order__date') - stock = stock.prefetch_related('purchase_order', 'supplier_part') + stock = part.stock_entries(include_variants=False, in_stock=True).\ + order_by('purchase_order__issue_date').prefetch_related('purchase_order', 'supplier_part') for stock_item in stock: if None in [stock_item.purchase_price, stock_item.quantity]: