You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 lines
888 B

# -*- coding: utf-8 -*-
##############################################################################
# (c) 2015 Pedro M. Baeza
# License AGPL-3 - See LICENSE file on root folder for details
##############################################################################
from odoo import models, api
class MailTemplate(models.Model):
_inherit = 'mail.template'
@api.model
def get_email_template(self, res_ids):
"""
Rebrowse a template with force_lang context key if it is set.
"""
if self.ids and res_ids and self.env.context.get('force_lang'):
self.ensure_one() # keep behaviour consistent with super function
template = self.with_context(lang=self.env.context['force_lang'])
return dict.fromkeys(res_ids, template)
else:
return super(MailTemplate, self).get_email_template(res_ids)