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.

18 lines
592 B

  1. # Copyright 2017 Tecnativa - Pedro M. Baeza
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo import _, exceptions, models
  4. class MailMassMailingList(models.Model):
  5. _inherit = "mail.mass_mailing"
  6. def button_draft(self):
  7. """Return to draft state for resending the mass mailing."""
  8. if any(self.mapped(lambda x: x.state != 'done')):
  9. raise exceptions.UserError(
  10. _("You can't resend a mass mailing that is being sent or in "
  11. "draft state.")
  12. )
  13. self.write({'state': 'draft'})