mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-01 17:41:33 +00:00
Prevent creation of duplicate backend objects
This commit is contained in:
@@ -250,13 +250,12 @@ def update_exchange_rates():
|
|||||||
try:
|
try:
|
||||||
backend = ExchangeBackend.objects.get(name='InvenTreeExchange')
|
backend = ExchangeBackend.objects.get(name='InvenTreeExchange')
|
||||||
except ExchangeBackend.DoesNotExist:
|
except ExchangeBackend.DoesNotExist:
|
||||||
pass
|
backend = InvenTreeExchange()
|
||||||
except Exception: # pragma: no cover
|
except Exception: # pragma: no cover
|
||||||
# Some other error
|
# Some other error
|
||||||
logger.warning("update_exchange_rates: Database not ready")
|
logger.warning("update_exchange_rates: Database not ready")
|
||||||
return
|
return
|
||||||
|
|
||||||
backend = InvenTreeExchange()
|
|
||||||
logger.info(f"Updating exchange rates from {backend.url}")
|
logger.info(f"Updating exchange rates from {backend.url}")
|
||||||
|
|
||||||
base = currency_code_default()
|
base = currency_code_default()
|
||||||
|
Reference in New Issue
Block a user