From fbb120da5338fb737ddfcfdb3b9e6c7a0779d04e Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 2 May 2019 18:53:03 +1000 Subject: [PATCH] Use collapse template in allocation page --- InvenTree/build/templates/build/allocate.html | 2 +- .../templates/build/allocation_item.html | 64 +++++++++---------- InvenTree/part/models.py | 6 ++ 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/InvenTree/build/templates/build/allocate.html b/InvenTree/build/templates/build/allocate.html index c3cda38429..1a8c018e01 100644 --- a/InvenTree/build/templates/build/allocate.html +++ b/InvenTree/build/templates/build/allocate.html @@ -11,7 +11,7 @@
{% for bom_item in bom_items.all %} -{% include "build/allocation_item.html" with item=bom_item build=build %} +{% include "build/allocation_item.html" with item=bom_item build=build collapse_id=bom_item.id %} {% endfor %} diff --git a/InvenTree/build/templates/build/allocation_item.html b/InvenTree/build/templates/build/allocation_item.html index 9982457aca..f9e92a63a8 100644 --- a/InvenTree/build/templates/build/allocation_item.html +++ b/InvenTree/build/templates/build/allocation_item.html @@ -1,38 +1,32 @@ +{% extends "collapse.html" %} + {% load inventree_extras %} -
-
-
-
- -
- Required: -
-
- {% multiply build.quantity item.quantity %} -
-
- Allocated: -
-
- 0 -
-
-
- -
-
-
-
-
-
-
-
- - +{% block collapse_title %} +{{ item.sub_part.name }} +{% endblock %} + +{% block collapse_heading %} +
+ Required:
- \ No newline at end of file +
+ {% multiply build.quantity item.quantity %} +
+
+ Allocated: +
+
+ 0 +
+
+
+ +
+
+{% endblock %} + +{% block collapse_content %} + +
+{% endblock %} \ No newline at end of file diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index ab83b584cd..c5e7683427 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -307,6 +307,12 @@ class Part(models.Model): def used_in_count(self): return self.used_in.count() + def required_parts(self): + parts = [] + for bom in self.bom_items.all(): + parts.append(bom.sub_part) + return parts + @property def supplier_count(self): # Return the number of supplier parts available for this part