From 87c463c039d07ec8a597c6107cf87452c794a2d5 Mon Sep 17 00:00:00 2001 From: Samir Ladoui Date: Sun, 7 Jul 2024 15:38:23 +0100 Subject: [PATCH] [FIX] odex_web_app: conflicts between 2 modules on user_push_notification function --- odex25_mobile/odex_web_app/models/hr_employee.py | 2 +- odex25_mobile/odex_web_app/models/mail_thread.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/odex25_mobile/odex_web_app/models/hr_employee.py b/odex25_mobile/odex_web_app/models/hr_employee.py index 2380f685b..863dc1cbe 100644 --- a/odex25_mobile/odex_web_app/models/hr_employee.py +++ b/odex25_mobile/odex_web_app/models/hr_employee.py @@ -14,7 +14,7 @@ class HrEmployee(models.Model): fcm_token_web = fields.Char(string='FCM Web Token') - def user_push_notification(self, notification): + def user_push_notification_web(self, notification): url = "https://fcm.googleapis.com/fcm/send" header = { 'Content-Type': 'application/json', diff --git a/odex25_mobile/odex_web_app/models/mail_thread.py b/odex25_mobile/odex_web_app/models/mail_thread.py index 17cd0843a..8c5652764 100644 --- a/odex25_mobile/odex_web_app/models/mail_thread.py +++ b/odex25_mobile/odex_web_app/models/mail_thread.py @@ -15,7 +15,7 @@ class MailThread(models.AbstractModel): notification_body = '{} File(s)'.format(attachments) partners_to_notify = self.channel_partner_ids.filtered(lambda r: r.id != self.env.user.partner_id.id) - for employee_id in partners_to_notify.user_ids.employee_id: - push_notify = employee_id.user_push_notification(notification_body) + for employee_id in self.env['hr.employee'].sudo().search([('user_id', 'in', partners_to_notify.user_ids.ids)]): + push_notify = employee_id.user_push_notification_web(notification_body) return super(MailThread, self).message_post(message_type=message_type, **kwargs)