Merge pull request #691 from SchrodingersGat/default-currency

auto-fill price break with default quantity
This commit is contained in:
Oliver 2020-03-31 22:14:10 +11:00 committed by GitHub
commit 40822a93df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,8 @@ from InvenTree.views import AjaxCreateView, AjaxUpdateView, AjaxDeleteView
from InvenTree.status_codes import OrderStatus
from InvenTree.helpers import str2bool
from common.models import Currency
from .models import Company
from .models import SupplierPart
from .models import SupplierPriceBreak
@ -330,6 +332,13 @@ class PriceBreakCreate(AjaxCreateView):
initials['part'] = self.get_part()
# Pre-select the default currency
try:
base = Currency.objects.get(base=True)
initials['currency'] = base
except Currency.DoesNotExist:
pass
return initials