Currency: Use ExchangeRateHost backend by default, rather than fixer.io

- No longer support fixer.io as it requires an API key and does not support "base" currency
This commit is contained in:
Oliver Walters 2021-05-25 10:37:53 +10:00
parent 817287a26c
commit 619cba6007
3 changed files with 2 additions and 15 deletions

View File

@ -169,18 +169,12 @@ def update_exchange_rates():
try: try:
import common.models import common.models
from django.conf import settings from django.conf import settings
from djmoney.contrib.exchange.backends import FixerBackend from InvenTree.exchange import ExchangeRateHostBackend
except AppRegistryNotReady: except AppRegistryNotReady:
# Apps not yet loaded! # Apps not yet loaded!
return return
fixer_api_key = common.models.InvenTreeSetting.get_setting('INVENTREE_FIXER_API_KEY', '').strip() backend = ExchangeRateHostBackend()
if not fixer_api_key:
# API key not provided
return
backend = FixerBackend(access_key=fixer_api_key)
currencies = ','.join(settings.CURRENCIES) currencies = ','.join(settings.CURRENCIES)

View File

@ -87,12 +87,6 @@ class InvenTreeSetting(models.Model):
'choices': djmoney.settings.CURRENCY_CHOICES, 'choices': djmoney.settings.CURRENCY_CHOICES,
}, },
'INVENTREE_FIXER_API_KEY': {
'name': _('fixer.io API key'),
'description': _('API key for fixer.io currency conversion service'),
'default': '',
},
'INVENTREE_DOWNLOAD_FROM_URL': { 'INVENTREE_DOWNLOAD_FROM_URL': {
'name': _('Download from URL'), 'name': _('Download from URL'),
'description': _('Allow download of remote images and files from external URL'), 'description': _('Allow download of remote images and files from external URL'),

View File

@ -20,7 +20,6 @@
{% include "InvenTree/settings/setting.html" with key="INVENTREE_BASE_URL" icon="fa-globe" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_BASE_URL" icon="fa-globe" %}
{% include "InvenTree/settings/setting.html" with key="INVENTREE_COMPANY_NAME" icon="fa-building" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_COMPANY_NAME" icon="fa-building" %}
{% include "InvenTree/settings/setting.html" with key="INVENTREE_DEFAULT_CURRENCY" icon="fa-dollar-sign" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_DEFAULT_CURRENCY" icon="fa-dollar-sign" %}
{% include "InvenTree/settings/setting.html" with key="INVENTREE_FIXER_API_KEY" icon="fa-key" %}
{% include "InvenTree/settings/setting.html" with key="INVENTREE_DOWNLOAD_FROM_URL" icon="fa-cloud-download-alt" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_DOWNLOAD_FROM_URL" icon="fa-cloud-download-alt" %}
</tbody> </tbody>
</table> </table>