mail/wizard/mail_blacklist_remove.py

23 lines
659 B
Python
Raw Normal View History

2024-05-03 12:40:35 +03:00
# -*- coding: utf-8 -*-
from markupsafe import Markup
from odoo import fields, models, _
class MailBlacklistRemove(models.TransientModel):
_name = 'mail.blacklist.remove'
_description = 'Remove email from blacklist wizard'
email = fields.Char(name="Email", readonly=True, required=True)
reason = fields.Char(name="Reason")
def action_unblacklist_apply(self):
if self.reason:
message = Markup('<p>%s</p>') % _("Unblock Reason: %(reason)s", reason=self.reason)
else:
message = None
return self.env['mail.blacklist']._remove(
self.email,
message=message,
)