From e08f706b11fddce1a067d5d6bcc13ec3cd1dec1c Mon Sep 17 00:00:00 2001 From: Tatiana Deribina Date: Wed, 31 Jul 2019 11:36:59 +0000 Subject: [PATCH] [FIX] mail: translate message of copied object When duplicating a record, the language is set to None in the context when copying a record new = self.with_context(lang=None).create(vals) self.with_context(from_copy_translation=True).copy_translations(new, excluded=default or ()) In mail.thread, the usecase of no language in the context was considered if 'lang' not in self._context: track_threads = threads.with_context(lang=self.env.user.lang) but not the case of a language explicitly set to None This means that, when duplicating a record, the tracked fields mesages were untranslated. Fixes odoo/odoo#35213 Closes odoo/odoo#35331 Signed-off-by: Martin Trigaux (mat) --- addons/mail/models/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 8ab60dbbb1c..cf081635fde 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -288,7 +288,7 @@ class MailThread(models.AbstractModel): # track values if not self._context.get('mail_notrack'): - if 'lang' not in self._context: + if not self._context.get('lang'): track_threads = threads.with_context(lang=self.env.user.lang) else: track_threads = threads