diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index b3399ece59..ada9db1e08 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -269,13 +269,17 @@ class Build(MPTTModel): else: descendants = self.get_descendants(include_self=True) Build.objects.filter(parent__pk__in=[d.pk for d in descendants]) - def sub_build_count(self, cascade=True): + """ + Return the number of sub builds under this one. + + Args: + cascade: If True (defualt), include cascading builds under sub builds + """ return self.sub_builds(cascade=cascade).count() - @property def is_overdue(self): """ diff --git a/InvenTree/build/templates/build/build_children.html b/InvenTree/build/templates/build/build_children.html index 87c8bd8608..c996aaa84f 100644 --- a/InvenTree/build/templates/build/build_children.html +++ b/InvenTree/build/templates/build/build_children.html @@ -25,6 +25,8 @@ {% block js_ready %} +{{ block.super }} + loadBuildTable($('#sub-build-table'), { url: '{% url "api-build-list" %}', filterTarget: "#filter-list-sub-build", diff --git a/InvenTree/build/test_api.py b/InvenTree/build/test_api.py index 41b09c8e08..bcfd600e9e 100644 --- a/InvenTree/build/test_api.py +++ b/InvenTree/build/test_api.py @@ -4,7 +4,6 @@ from __future__ import unicode_literals from datetime import datetime, timedelta from rest_framework.test import APITestCase -from rest_framework import status from django.urls import reverse from django.contrib.auth import get_user_model @@ -64,11 +63,11 @@ class BuildListTest(BuildAPITest): url = reverse('api-build-list') - def get(self, status=200, data={}): + def get(self, status_code=200, data={}): response = self.client.get(self.url, data, format='json') - self.assertEqual(response.status_code, status) + self.assertEqual(response.status_code, status_code) return response.data @@ -102,7 +101,7 @@ class BuildListTest(BuildAPITest): part = Part.objects.get(pk=50) - build = Build.objects.create( + Build.objects.create( part=part, quantity=10, title='Just some thing', diff --git a/InvenTree/report/templates/report/inventree_build_order_base.html b/InvenTree/report/templates/report/inventree_build_order_base.html index 0a4f8b3bb6..46e7544df5 100644 --- a/InvenTree/report/templates/report/inventree_build_order_base.html +++ b/InvenTree/report/templates/report/inventree_build_order_base.html @@ -2,9 +2,9 @@ {% load i18n %} {% load report %} +{% load barcode %} {% load inventree_extras %} {% load markdownify %} -{% load qr_code %} {% block page_margin %} margin: 2cm;