diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 3908816454..0d42ae77c7 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -65,6 +65,20 @@ class Build(MPTTModel): verbose_name = _("Build Order") verbose_name_plural = _("Build Orders") + def format_barcode(self, **kwargs): + """ + Return a JSON string to represent this build as a barcode + """ + + return helpers.MakeBarcode( + "buildorder", + self.pk, + { + "reference": self.title, + "url": self.get_absolute_url(), + } + ) + @staticmethod def filterByDate(queryset, min_date, max_date): """ diff --git a/InvenTree/report/templates/report/inventree_build_order_base.html b/InvenTree/report/templates/report/inventree_build_order_base.html index 1e2dd26c07..0a4f8b3bb6 100644 --- a/InvenTree/report/templates/report/inventree_build_order_base.html +++ b/InvenTree/report/templates/report/inventree_build_order_base.html @@ -4,6 +4,7 @@ {% load report %} {% load inventree_extras %} {% load markdownify %} +{% load qr_code %} {% block page_margin %} margin: 2cm; diff --git a/InvenTree/stock/tests.py b/InvenTree/stock/tests.py index 55fbdef826..b54411b0d2 100644 --- a/InvenTree/stock/tests.py +++ b/InvenTree/stock/tests.py @@ -110,7 +110,7 @@ class StockTest(TestCase): # The "is_building" quantity should not be counted here self.assertEqual(part.total_stock, n + 5) - self.assertEqual(part.quantity_being_built, 100) + self.assertEqual(part.quantity_being_built, 1) def test_loc_count(self): self.assertEqual(StockLocation.objects.count(), 7)