From a3e6a37c1b2c95d440c0e7824eeeb2129576371c Mon Sep 17 00:00:00 2001
From: zainab2097 <149927291+zainab2097@users.noreply.github.com>
Date: Tue, 24 Sep 2024 13:54:46 +0300
Subject: [PATCH] Update mail_activity.py
---
odex25_mobile/odex_web_app/models/mail_activity.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
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