From 3b9f57fc803988e3c8a52840a28a65827f58e943 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 18 Mar 2020 20:44:45 +1100 Subject: [PATCH] Bug fix - Multiplying float by decimal - Overage percentage now uses explicit decimal multiplication --- InvenTree/part/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 59bcbe57b1..f305b51c4c 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -27,6 +27,7 @@ from django_cleanup import cleanup from mptt.models import TreeForeignKey +from decimal import Decimal from datetime import datetime from fuzzywuzzy import fuzz import hashlib @@ -1208,6 +1209,9 @@ class BomItem(models.Model): if percent < 0: percent = 0 + # Must be represented as a decimal + percent = Decimal(percent) + return int(percent * quantity) except ValueError: