mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Only send printing failed as a UI notification
This commit is contained in:
		| @@ -154,11 +154,18 @@ class UIMessageNotification(SingleNotificationMethod): | ||||
|         return True | ||||
|  | ||||
|  | ||||
| def trigger_notifaction(obj, category=None, obj_ref='pk', targets=None, target_fnc=None, target_args=[], target_kwargs={}, context={}): | ||||
| def trigger_notifaction(obj, category=None, obj_ref='pk', **kwargs): | ||||
|     """ | ||||
|     Send out a notification | ||||
|     """ | ||||
|  | ||||
|     targets = kwargs.get('targets', None) | ||||
|     target_fnc = kwargs.get('target_fnc', None) | ||||
|     target_args = kwargs.get('target_args', []) | ||||
|     target_kwargs = kwargs.get('target_kwargs', {}) | ||||
|     context = kwargs.get('context', {}) | ||||
|     delivery_methods = kwargs.get('delivery_methods', None) | ||||
|  | ||||
|     # Check if data is importing currently | ||||
|     if isImportingData(): | ||||
|         return | ||||
| @@ -190,7 +197,8 @@ def trigger_notifaction(obj, category=None, obj_ref='pk', targets=None, target_f | ||||
|         logger.info(f"Sending notification '{category}' for '{str(obj)}'") | ||||
|  | ||||
|         # Collect possible methods | ||||
|         delivery_methods = inheritors(NotificationMethod) | ||||
|         if delivery_methods is None: | ||||
|             delivery_methods = inheritors(NotificationMethod) | ||||
|  | ||||
|         for method in [a for a in delivery_methods if a not in [SingleNotificationMethod, BulkNotificationMethod]]: | ||||
|             logger.info(f"Triggering method '{method.METHOD_NAME}'") | ||||
|   | ||||
| @@ -233,4 +233,5 @@ def print_label(plugin_slug, label_image, label_instance=None, user=None): | ||||
|             'label.printing_failed', | ||||
|             targets=[user], | ||||
|             context=ctx, | ||||
|             delivery_methods=[common.notifications.UIMessageNotification] | ||||
|         ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user