loyalty_mail.py 790 B

123456789101112131415161718192021
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo import fields, models
  4. # Allow promo programs to send mails upon certain triggers
  5. # Like : 'At creation' and 'When reaching X points'
  6. class LoyaltyMail(models.Model):
  7. _name = 'loyalty.mail'
  8. _description = 'Loyalty Communication'
  9. active = fields.Boolean(default=True)
  10. program_id = fields.Many2one('loyalty.program', required=True, ondelete='cascade')
  11. trigger = fields.Selection([
  12. ('create', 'At Creation'),
  13. ('points_reach', 'When Reaching')], string='When', required=True
  14. )
  15. points = fields.Float()
  16. mail_template_id = fields.Many2one('mail.template', string="Email Template", required=True, domain=[('model', '=', 'loyalty.card')])