From de332ef98d9b44b4e5bb845379186044d9ac4194 Mon Sep 17 00:00:00 2001 From: eLBati Date: Fri, 8 Dec 2017 09:19:59 +0100 Subject: [PATCH] FIX mail_footer_notified_partner we need to save the complete list of partners because _message_notification_recipients builds recipients grouped by users groups. Thus get_additional_footer would get a partial list of recipients --- mail_footer_notified_partner/__manifest__.py | 2 +- .../models/mail_followers.py | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/mail_footer_notified_partner/__manifest__.py b/mail_footer_notified_partner/__manifest__.py index ec17adeb..f2fd1356 100644 --- a/mail_footer_notified_partner/__manifest__.py +++ b/mail_footer_notified_partner/__manifest__.py @@ -11,7 +11,7 @@ "installable": True, "website": "http://acsone.eu", "category": "Mail", - "version": "10.0.1.0.0", + "version": "10.0.1.0.1", "license": "AGPL-3", "depends": [ "mail", diff --git a/mail_footer_notified_partner/models/mail_followers.py b/mail_footer_notified_partner/models/mail_followers.py index 2c1ddc3f..f3be14e1 100644 --- a/mail_footer_notified_partner/models/mail_followers.py +++ b/mail_footer_notified_partner/models/mail_followers.py @@ -9,9 +9,28 @@ from odoo.tools.translate import _ class MailNotification(models.Model): _inherit = 'res.partner' + @api.multi + def _notify_by_email( + self, message, force_send=False, send_after_commit=True, + user_signature=True + ): + # we need to save the complete list of partners because + # _message_notification_recipients builds recipients + # grouped by users groups. Thus get_additional_footer would get a + # partial list of recipients + return super( + MailNotification, self.with_context(notified_partners=self) + )._notify_by_email( + message, force_send=force_send, + send_after_commit=send_after_commit, + user_signature=user_signature + ) + @api.model def _notify_send(self, body, subject, recipients, **mail_values): - body += self.get_additional_footer(recipients) + footer_recipients = self.env.context.get( + 'notified_partners', recipients) or recipients + body += self.get_additional_footer(footer_recipients) return super(MailNotification, self).\ _notify_send(body, subject, recipients, **mail_values)