From 6e26bd0b71bd03786832a6962d574aa98fee5dc6 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 9 Jul 2021 01:29:17 +1000 Subject: [PATCH] Fixes for unit tests --- InvenTree/build/test_build.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/InvenTree/build/test_build.py b/InvenTree/build/test_build.py index a3b69646dd..b572feb14b 100644 --- a/InvenTree/build/test_build.py +++ b/InvenTree/build/test_build.py @@ -5,10 +5,11 @@ from django.test import TestCase from django.core.exceptions import ValidationError from django.db.utils import IntegrityError -from build.models import Build, BuildItem +from InvenTree import status_codes as status + +from build.models import Build, BuildItem, get_next_build_number from stock.models import StockItem from part.models import Part, BomItem -from InvenTree import status_codes as status class BuildTest(TestCase): @@ -80,8 +81,14 @@ class BuildTest(TestCase): quantity=2 ) + ref = get_next_build_number() + + if ref is None: + ref = "0001" + # Create a "Build" object to make 10x objects self.build = Build.objects.create( + reference=ref, title="This is a build", part=self.assembly, quantity=10