Files
odoo_source/addons/mass_mailing/wizard/mass_mailing_schedule_date.py
T
dip-odoo bbda48231c [IMP] mass_mailing: add schedule button that opens a wizard for scheduling date
Purpose of this commit is to re-arrange mass mailing buttons and to add
a button for scheduling mass mailing in future :

 * add schedule date in debug mode;
 * re-arrange all button;
 * add schedule in future button and on click open wizard to schedule future
   date;
 * on 'send now' button remove the useless '|' in domain;
 * add a small wizard to select the send date;

This commit is related to task ID 46932
2018-05-25 16:23:48 +02:00

23 lines
872 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class MassMailingScheduleDate(models.TransientModel):
_name = 'mass.mailing.schedule.date'
_description = 'Schedule in the Future'
schedule_date = fields.Datetime(string='Schedule in the Future')
mass_mailing_id = fields.Many2one('mail.mass_mailing', required=True)
@api.constrains('schedule_date')
def _check_schedule_date(self):
for scheduler in self:
if scheduler.schedule_date < fields.Datetime.now():
raise ValidationError(_('Please select a date equal/or greater than the current date.'))
def set_schedule_date(self):
self.mass_mailing_id.write({'schedule_date': self.schedule_date, 'state': 'in_queue'})