diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 3a59db0cc6..652290cc4a 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -35,6 +35,7 @@ from InvenTree import helpers from InvenTree import validators from InvenTree.models import InvenTreeTree from InvenTree.fields import InvenTreeURLField +from InvenTree.helpers import decimal2string from InvenTree.status_codes import BuildStatus, StockStatus, OrderStatus @@ -1249,4 +1250,8 @@ class BomItem(models.Model): if pmin == pmax: return str(pmin) + # Convert to better string representation + pmin = decimal2string(pmin) + pmax = decimal2string(pmax) + return "{pmin} to {pmax}".format(pmin=pmin, pmax=pmax) diff --git a/InvenTree/part/test_part.py b/InvenTree/part/test_part.py index 2d3e5408bd..c7c3c014a1 100644 --- a/InvenTree/part/test_part.py +++ b/InvenTree/part/test_part.py @@ -1,6 +1,7 @@ # Tests for the Part model # -*- coding: utf-8 -*- + from __future__ import unicode_literals from django.test import TestCase @@ -16,7 +17,7 @@ class TemplateTagTest(TestCase): """ Tests for the custom template tag code """ def test_multiply(self): - self.assertEqual(inventree_extras.multiply(3, 5), 15) + self.assertEqual(int(inventree_extras.multiply(3, 5)), 15) def test_version(self): self.assertEqual(type(inventree_extras.inventree_version()), str)