From 6393ddad53542da6febe708d1fcc02e63d865b17 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 20 Aug 2019 12:44:00 +1000 Subject: [PATCH] Add param tab to Part detail view --- InvenTree/part/models.py | 5 +++++ InvenTree/part/templates/part/tabs.html | 3 +++ 2 files changed, 8 insertions(+) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 95a36f4804..f1e78f502d 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -971,6 +971,11 @@ class Part(models.Model): return sum([part.on_order() for part in self.supplier_parts.all().prefetch_related('purchase_order_line_items')]) + def get_parameters(self): + """ Return all parameters for this part, ordered by name """ + + return self.parameters.order_by('name') + def attach_file(instance, filename): """ Function for storing a file for a PartAttachment diff --git a/InvenTree/part/templates/part/tabs.html b/InvenTree/part/templates/part/tabs.html index aa7a9fa885..86b7986b00 100644 --- a/InvenTree/part/templates/part/tabs.html +++ b/InvenTree/part/templates/part/tabs.html @@ -2,6 +2,9 @@ Details + + Parameters {{ part.parameters.count }} + {% if part.is_template %} Variants {{ part.variants.count }}