[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) <mat@odoo.com>
This commit is contained in:
Tatiana Deribina
2019-08-01 12:48:22 +00:00
committed by Martin Trigaux
parent 659aa432aa
commit e08f706b11
+1 -1
View File
@@ -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