diff --git a/product/ERP5/Document/Alarm.py b/product/ERP5/Document/Alarm.py index 64e80b431b2dbcc6c0e1bc2452427cf357a92933..e17b898b53ed9c79ae4c39d10f09bef318f8dbe9 100644 --- a/product/ERP5/Document/Alarm.py +++ b/product/ERP5/Document/Alarm.py @@ -430,14 +430,19 @@ class Alarm(XMLObject, PeriodicityMixin): to the system address if nothing was defined or to notify all agents defined on the alarm if specified. """ - notification_tool = getToolByName(self, 'portal_notifications') - candidate_list = self.getDestinationValueList() - if not candidate_list: - candidate_list = None + notification_mode = self.getAlarmNotificationMode() + if notification_mode == 'never': + return if self.sense(): prefix = 'ERROR' else: + if notification_mode != 'always' + return prefix = 'INFO' + notification_tool = getToolByName(self, 'portal_notifications') + candidate_list = self.getDestinationValueList() + if not candidate_list: + candidate_list = None notification_tool.sendMessage(recipient=candidate_list, subject='[%s] ERP5 Alarm Notification: %s' % (prefix, self.getTitle()),