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.

19 lines
616 B

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