From d05b75dbe4c3713e26db18f92b1b2873c755c377 Mon Sep 17 00:00:00 2001 From: Benoit Date: Thu, 18 Feb 2021 10:22:35 +0100 Subject: [PATCH] fix migraiton of mail_usability --- mail_usability/data/mail_data.xml | 5 +++++ mail_usability/models/mail.py | 4 ++-- mail_usability/models/res_partner.py | 17 ++++++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/mail_usability/data/mail_data.xml b/mail_usability/data/mail_data.xml index 538fb44..0b510e4 100644 --- a/mail_usability/data/mail_data.xml +++ b/mail_usability/data/mail_data.xml @@ -10,4 +10,9 @@ ${object.body | safe} + + + diff --git a/mail_usability/models/mail.py b/mail_usability/models/mail.py index 2fca1f2..d8a92c7 100644 --- a/mail_usability/models/mail.py +++ b/mail_usability/models/mail.py @@ -15,10 +15,10 @@ class MailThread(models.AbstractModel): _logger.debug('Skip automatic subscribe notification') return False - def _message_auto_subscribe_notify(self, partner_ids): + def _message_auto_subscribe_notify(self, partner_ids, template): if self._active_message_auto_subscribe_notify(): return super(MailThread, self)._message_auto_subscribe_notify( - partner_ids) + partner_ids, template) else: return True diff --git a/mail_usability/models/res_partner.py b/mail_usability/models/res_partner.py index 86100a7..994df15 100644 --- a/mail_usability/models/res_partner.py +++ b/mail_usability/models/res_partner.py @@ -13,16 +13,15 @@ class ResPartner(models.Model): @api.model def _notify(self, message, rdata, record, force_send=False, - send_after_commit=True, model_description=False, - mail_auto_delete=True): - # use an empty layout for notification by default - if not self._context.get('custom_layout'): - self = self.with_context( - custom_layout='mail_usability.mail_template_notification') + send_after_commit=True, model_description=False, + mail_auto_delete=True): + # use an empty layout for notification by default + if not message.layout: + message.layout = 'mail_usability.message_notification_email_usability' # Never auto delete notification email # fucking to hard to debug when message have been delete mail_auto_delete = False return super(ResPartner, self)._notify( - message=message, rdata=rdata, record=record, - force_send=force_send, send_after_commit=send_after_commit, - model_description=model_description, mail_auto_delete=mail_auto_delete) + message=message, rdata=rdata, record=record, + force_send=force_send, send_after_commit=send_after_commit, + model_description=model_description, mail_auto_delete=mail_auto_delete)