From 619cba6007c92c0ac75d6c2c755e8e7fdea58df5 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 25 May 2021 10:37:53 +1000 Subject: [PATCH] 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 --- InvenTree/InvenTree/tasks.py | 10 ++-------- InvenTree/common/models.py | 6 ------ InvenTree/templates/InvenTree/settings/global.html | 1 - 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/InvenTree/InvenTree/tasks.py b/InvenTree/InvenTree/tasks.py index b81b4e6de4..e9e37e63a3 100644 --- a/InvenTree/InvenTree/tasks.py +++ b/InvenTree/InvenTree/tasks.py @@ -169,18 +169,12 @@ def update_exchange_rates(): try: import common.models from django.conf import settings - from djmoney.contrib.exchange.backends import FixerBackend + from InvenTree.exchange import ExchangeRateHostBackend except AppRegistryNotReady: # Apps not yet loaded! return - fixer_api_key = common.models.InvenTreeSetting.get_setting('INVENTREE_FIXER_API_KEY', '').strip() - - if not fixer_api_key: - # API key not provided - return - - backend = FixerBackend(access_key=fixer_api_key) + backend = ExchangeRateHostBackend() currencies = ','.join(settings.CURRENCIES) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index e499e9b801..99712b2a93 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -87,12 +87,6 @@ class InvenTreeSetting(models.Model): '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': { 'name': _('Download from URL'), 'description': _('Allow download of remote images and files from external URL'), diff --git a/InvenTree/templates/InvenTree/settings/global.html b/InvenTree/templates/InvenTree/settings/global.html index 5c5dccfb2a..a0347490d0 100644 --- a/InvenTree/templates/InvenTree/settings/global.html +++ b/InvenTree/templates/InvenTree/settings/global.html @@ -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_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_FIXER_API_KEY" icon="fa-key" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_DOWNLOAD_FROM_URL" icon="fa-cloud-download-alt" %}