mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improve calculation of BOM item overage
This commit is contained in:
parent
3fd0cf67b6
commit
15bc457714
@ -1198,9 +1198,9 @@ class BomItem(models.Model):
|
|||||||
|
|
||||||
overage = str(self.overage).strip()
|
overage = str(self.overage).strip()
|
||||||
|
|
||||||
# Is the overage an integer value?
|
# Is the overage a numerical value?
|
||||||
try:
|
try:
|
||||||
ovg = int(overage)
|
ovg = float(overage)
|
||||||
|
|
||||||
if ovg < 0:
|
if ovg < 0:
|
||||||
ovg = 0
|
ovg = 0
|
||||||
@ -1223,7 +1223,7 @@ class BomItem(models.Model):
|
|||||||
# Must be represented as a decimal
|
# Must be represented as a decimal
|
||||||
percent = Decimal(percent)
|
percent = Decimal(percent)
|
||||||
|
|
||||||
return int(percent * quantity)
|
return float(percent * quantity)
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
@ -1245,7 +1245,12 @@ class BomItem(models.Model):
|
|||||||
# Base quantity requirement
|
# Base quantity requirement
|
||||||
base_quantity = self.quantity * build_quantity
|
base_quantity = self.quantity * build_quantity
|
||||||
|
|
||||||
return base_quantity + self.get_overage_quantity(base_quantity)
|
# Overage requiremet
|
||||||
|
ovrg_quantity = self.get_overage_quantity(base_quantity)
|
||||||
|
|
||||||
|
required = float(base_quantity) + float(ovrg_quantity)
|
||||||
|
|
||||||
|
return required
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def price_range(self):
|
def price_range(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user