2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

Select the default currency if one is not specifically selected

This commit is contained in:
Oliver Walters 2019-09-03 22:33:50 +10:00
parent 3682e9b5fb
commit 41806089e3

View File

@ -1337,6 +1337,13 @@ class PartPricing(AjaxView):
if quantity < 1: if quantity < 1:
quantity = 1 quantity = 1
if currency is None:
# No currency selected? Try to select a default one
try:
currency = Currency.objects.get(base=1)
except Currency.DoesNotExist:
currency = None
# Currency scaler # Currency scaler
scaler = Decimal(1.0) scaler = Decimal(1.0)
@ -1418,8 +1425,7 @@ class PartPricing(AjaxView):
if currency_id: if currency_id:
currency = Currency.objects.get(pk=currency_id) currency = Currency.objects.get(pk=currency_id)
except (ValueError, Currency.DoesNotExist): except (ValueError, Currency.DoesNotExist):
pass currency = None
# Always mark the form as 'invalid' (the user may wish to keep getting pricing data) # Always mark the form as 'invalid' (the user may wish to keep getting pricing data)
data = { data = {