diff --git a/odex25_mobile/odex_web_app/models/mail_activity.py b/odex25_mobile/odex_web_app/models/mail_activity.py index aceef2e6f..4e379d535 100644 --- a/odex25_mobile/odex_web_app/models/mail_activity.py +++ b/odex25_mobile/odex_web_app/models/mail_activity.py @@ -11,7 +11,9 @@ class MailActivity(models.Model): activity_ids = super(MailActivity, self).create(values) for activity_id in activity_ids: # Build message content - notification_body = re.sub(r'<[^>]+>', '', activity_id.note.replace('
', '\n')) + # Ensure activity_id.note is valid and avoid errors + note = activity_id.note or '' + notification_body = re.sub(r'<[^>]+>', '', note.replace('
', '\n')) # Send notifications employee_id = self.env['hr.employee'].sudo().search([('user_id', '=', activity_id.user_id.id)]) @@ -20,4 +22,4 @@ class MailActivity(models.Model): "title": activity_id.summary or activity_id.create_uid.name, "body": notification_body }) - return activity_ids \ No newline at end of file + return activity_ids