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
867 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016-2017 Compassion CH (http://www.compassion.ch)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from odoo import models, fields
  5. class LanguageTemplate(models.Model):
  6. """ This class is the relation between and email_template object
  7. and a sendgrid_template. It allows to specify a different
  8. sendgrid_template for any selected language.
  9. """
  10. _name = 'sendgrid.email.lang.template'
  11. email_template_id = fields.Many2one('mail.template', 'E-mail Template')
  12. lang = fields.Selection('_select_lang', 'Language', required=True)
  13. sendgrid_template_id = fields.Many2one(
  14. 'sendgrid.template', 'Sendgrid Template', required=True)
  15. def _select_lang(self):
  16. languages = self.env['res.lang'].search([])
  17. return [(language.code, language.name) for language in languages]