From 71c3ff4b9fdeb6c7580defec8fdc3ca1f9b303c2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 11 May 2021 16:15:10 +0200 Subject: [PATCH] prefetching related information --- InvenTree/part/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 6f8d66de21..1fdc5b60e3 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -2043,7 +2043,8 @@ class PartPricing(AjaxView): # Stock history if part_settings.part_show_graph and part.total_stock > 1: ret = [] - stock = part.stock_entries(include_variants=False, in_stock=True) + stock = part.stock_entries(include_variants=False, in_stock=True) #.order_by('purchase_order__date') + stock = stock.prefetch_related('purchase_order', 'supplier_part') for stock_item in stock: if None in [stock_item.purchase_price, stock_item.quantity]: