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

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2018 ACSONE SA/NV
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import api, fields, models
  5. class EmailTemplate(models.Model):
  6. _inherit = 'email.template'
  7. # Fake field for auto-completing placeholder
  8. placeholder_id = fields.Many2one(
  9. 'email.template.placeholder', string="Placeholder")
  10. placeholder_value = fields.Char(
  11. help='Placeholder value to copy-paste in the desired template field')
  12. @api.onchange('placeholder_id')
  13. def _onchange_placeholder_id(self):
  14. for tmpl in self:
  15. if tmpl.placeholder_id:
  16. tmpl.placeholder_value = tmpl.placeholder_id.placeholder