Add function to make barcode for build order

This commit is contained in:
Oliver Walters 2021-02-17 13:47:14 +11:00
parent 98bd7dfa9a
commit 08cc866e74
3 changed files with 16 additions and 1 deletions

View File

@ -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):
"""

View File

@ -4,6 +4,7 @@
{% load report %}
{% load inventree_extras %}
{% load markdownify %}
{% load qr_code %}
{% block page_margin %}
margin: 2cm;

View File

@ -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)