mailing_mailing_schedule_date.py 600 B

1234567891011121314151617
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo import fields, models
  4. class MailingMailingScheduleDate(models.TransientModel):
  5. _name = "mailing.mailing.schedule.date"
  6. _description = "schedule a mailing"
  7. schedule_date = fields.Datetime(string='Scheduled for')
  8. mass_mailing_id = fields.Many2one('mailing.mailing', required=True)
  9. def action_schedule_date(self):
  10. self.mass_mailing_id.write({'schedule_type': 'scheduled', 'schedule_date': self.schedule_date})
  11. self.mass_mailing_id.action_put_in_queue()