2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-20 13:56:30 +00:00

Further work on decimal rounding

- Prevent numbers from being represented in scientific notation
This commit is contained in:
Oliver Walters
2020-04-12 00:56:15 +10:00
parent 04cee99791
commit 3c46e12839
4 changed files with 31 additions and 10 deletions

View File

@ -37,7 +37,7 @@ from InvenTree import helpers
from InvenTree import validators
from InvenTree.models import InvenTreeTree, InvenTreeAttachment
from InvenTree.fields import InvenTreeURLField
from InvenTree.helpers import decimal2string
from InvenTree.helpers import decimal2string, normalize
from InvenTree.status_codes import BuildStatus, StockStatus, OrderStatus
@ -781,8 +781,8 @@ class Part(models.Model):
if min_price == max_price:
return min_price
min_price = min_price.normalize()
max_price = max_price.normalize()
min_price = normalize(min_price)
max_price = normalize(max_price)
return "{a} - {b}".format(a=min_price, b=max_price)
@ -807,8 +807,8 @@ class Part(models.Model):
if min_price is None or max_price is None:
return None
min_price = min_price.normalize()
max_price = max_price.normalize()
min_price = normalize(min_price)
max_price = normalize(max_price)
return (min_price, max_price)
@ -843,8 +843,8 @@ class Part(models.Model):
if min_price is None or max_price is None:
return None
min_price = min_price.normalize()
max_price = max_price.normalize()
min_price = normalize(min_price)
max_price = normalize(max_price)
return (min_price, max_price)