mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #3 from matmair/pr1600
proposed changes for translation and safer backend loading
This commit is contained in:
commit
949920865b
@ -13,8 +13,10 @@ def get_exchange_rate_backend():
|
||||
|
||||
if 'InvenTreeManualExchangeBackend' in inventree_settings.EXCHANGE_BACKEND:
|
||||
return InvenTreeManualExchangeBackend()
|
||||
else:
|
||||
elif 'InvenTreeFixerExchangeBackend' in inventree_settings.EXCHANGE_BACKEND:
|
||||
return InvenTreeFixerExchangeBackend()
|
||||
else:
|
||||
raise ImproperlyConfigured('Exchange Backend wrongly configured')
|
||||
|
||||
|
||||
class InvenTreeManualExchangeBackend(BaseExchangeBackend):
|
||||
|
@ -959,7 +959,7 @@ class CurrencySettingsView(FormView):
|
||||
stored_rates = exchange_rate_backend.get_stored_rates()
|
||||
|
||||
for field in form.fields:
|
||||
if 'fixer' in exchange_rate_backend.name:
|
||||
if exchange_rate_backend.name.startswith('fixer-'):
|
||||
# Disable all the fields
|
||||
form.fields[field].disabled = True
|
||||
form.fields[field].initial = clean_decimal(stored_rates.get(field, 0))
|
||||
@ -973,7 +973,7 @@ class CurrencySettingsView(FormView):
|
||||
# Get exchange rate backend
|
||||
exchange_rate_backend = self.get_exchange_rate_backend()
|
||||
|
||||
if 'fixer' in exchange_rate_backend.name:
|
||||
if exchange_rate_backend.name.startswith('fixer-'):
|
||||
# Refresh rate from Fixer.IO API
|
||||
exchange_rate_backend.update_rates(base_currency=exchange_rate_backend.base_currency)
|
||||
# Check if rates have been updated
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
<h4>{% trans "Exchange Rates - Convert to " %}{{ default_currency }}</h4>
|
||||
<h4>{% blocktrans with cur=default_currency %}Exchange Rates - Convert to {{cur}}{% endblocktrans %}</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user