diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index e6c00a36a1..47264d2649 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -1,14 +1,16 @@ """InvenTree API version information.""" # InvenTree API version -INVENTREE_API_VERSION = 203 +INVENTREE_API_VERSION = 204 """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" INVENTREE_API_TEXT = """ +v204 - 2024-06-03 : https://github.com/inventree/InvenTree/pull/7393 + - Fixes previous API update which resulted in inconsistent ordering of currency codes v203 - 2024-06-03 : https://github.com/inventree/InvenTree/pull/7390 - - Adjust default currency codes + - Currency codes are now configurable as a run-time setting v202 - 2024-05-27 : https://github.com/inventree/InvenTree/pull/7343 - Adjust "required" attribute of Part.category field to be optional diff --git a/src/backend/InvenTree/InvenTree/cache.py b/src/backend/InvenTree/InvenTree/cache.py index 241ff1f4e6..89765f5e80 100644 --- a/src/backend/InvenTree/InvenTree/cache.py +++ b/src/backend/InvenTree/InvenTree/cache.py @@ -45,13 +45,9 @@ def is_global_cache_enabled(): return False # The cache should not be used during certain operations - if any(( - InvenTree.ready.isRunningBackup(), - InvenTree.ready.isRunningMigrations(), - InvenTree.ready.isRebuildingData(), - InvenTree.ready.isImportingData(), - InvenTree.ready.isInTestMode(), - )): + if not InvenTree.ready.canAppAccessDatabase( + allow_test=False, allow_plugins=False, allow_shell=True + ): logger.info('Global cache bypassed for this operation') return False diff --git a/src/backend/InvenTree/InvenTree/ready.py b/src/backend/InvenTree/InvenTree/ready.py index b8ebfb6e0a..41b3058fc8 100644 --- a/src/backend/InvenTree/InvenTree/ready.py +++ b/src/backend/InvenTree/InvenTree/ready.py @@ -114,6 +114,7 @@ def canAppAccessDatabase( 'wait_for_db', 'makemessages', 'compilemessages', + 'spectactular', ] if not allow_shell: diff --git a/src/backend/InvenTree/common/currency.py b/src/backend/InvenTree/common/currency.py index 542f81d1fc..c77549c550 100644 --- a/src/backend/InvenTree/common/currency.py +++ b/src/backend/InvenTree/common/currency.py @@ -68,20 +68,23 @@ def currency_codes() -> list: codes = codes.split(',') - valid_codes = set() + valid_codes = [] for code in codes: code = code.strip().upper() + if code in valid_codes: + continue + if code in CURRENCIES: - valid_codes.add(code) + valid_codes.append(code) else: logger.warning(f"Invalid currency code: '{code}'") if len(valid_codes) == 0: - valid_codes = set(currency_codes_default_list().split(',')) + valid_codes = list(currency_codes_default_list().split(',')) - return list(valid_codes) + return valid_codes def currency_code_mappings() -> list: