From 0a67975f16141adc6ce60ddf3ce7ded058e4842d Mon Sep 17 00:00:00 2001 From: Lavissa Date: Mon, 18 Mar 2024 23:09:47 +0100 Subject: [PATCH] Add ability to test event triggers (#6746) --- InvenTree/InvenTree/settings.py | 3 +++ InvenTree/plugin/base/event/events.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 2897b6d614..ff322ac10d 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -1221,6 +1221,9 @@ PLUGIN_RETRY = get_setting( ) # How often should plugin loading be tried? PLUGIN_FILE_CHECKED = False # Was the plugin file checked? +# Flag to allow table events during testing +TESTING_TABLE_EVENTS = False + # User interface customization values CUSTOM_LOGO = get_custom_file( 'INVENTREE_CUSTOM_LOGO', 'customize.logo', 'custom logo', lookup_media=True diff --git a/InvenTree/plugin/base/event/events.py b/InvenTree/plugin/base/event/events.py index 125d1b17bf..752a7a8d85 100644 --- a/InvenTree/plugin/base/event/events.py +++ b/InvenTree/plugin/base/event/events.py @@ -117,7 +117,7 @@ def allow_table_event(table_name): return False # pragma: no cover # Prevent table events when in testing mode (saves a lot of time) - if settings.TESTING: + if settings.TESTING and not settings.TESTING_TABLE_EVENTS: return False table_name = table_name.lower().strip()