diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 59a74eaf364..3cb4a2276b3 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -2870,7 +2870,9 @@ class MailThread(models.AbstractModel): for pid, sids, template in res: new_partners.setdefault(pid, sids) if template: - notify_data.setdefault(template, list()).append(pid) + partner = self.env['res.partner'].browse(pid) + lang = partner.lang if partner else None + notify_data.setdefault((template, lang), list()).append(pid) self.env['mail.followers']._insert_followers( self._name, self.ids, @@ -2879,8 +2881,8 @@ class MailThread(models.AbstractModel): check_existing=True, existing_policy='skip') # notify people from auto subscription, for example like assignation - for template, pids in notify_data.items(): - self._message_auto_subscribe_notify(pids, template) + for (template, lang), pids in notify_data.items(): + self.with_context(lang=lang)._message_auto_subscribe_notify(pids, template) return True diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py index 3c5de0a5986..64faed185b2 100644 --- a/addons/test_mail/tests/test_performance.py +++ b/addons/test_mail/tests/test_performance.py @@ -200,7 +200,7 @@ class TestAdvMailPerformance(BaseMailPerformance): def test_message_assignation_email(self): self.user_test.write({'notification_type': 'email'}) record = self.env['mail.test.track'].create({'name': 'Test'}) - with self.assertQueryCount(__system__=39, emp=40): + with self.assertQueryCount(__system__=40, emp=41): record.write({ 'user_id': self.user_test.id, })