From 8490589fa9b70287fef21dca4ac1a7dd3300e38b Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Sun, 1 May 2022 21:46:31 +0000 Subject: [PATCH] check for only unique methods to be added --- InvenTree/common/notifications.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/InvenTree/common/notifications.py b/InvenTree/common/notifications.py index 8e36dd02b3..c9dd08e8da 100644 --- a/InvenTree/common/notifications.py +++ b/InvenTree/common/notifications.py @@ -139,12 +139,21 @@ class MethodStorageClass: user_settings = {} def collect(self, selected_classes=None): + print('collecting') current_method = inheritors(NotificationMethod) - IGNORED_NOTIFICATION_CLS # for testing selective loading is made available if selected_classes: current_method = [item for item in current_method if item is selected_classes] - storage.liste = current_method + + # make sure only one of each method is added + filtered_list = {} + for item in current_method: + plugin = item.get_plugin(item) + ref = f'{plugin.package_path}_{item.METHOD_NAME}' if plugin else item.METHOD_NAME + filtered_list[ref] = item + + storage.liste = list(filtered_list.values()) def get_usersettings(self, user): methods = []