diff options
| author | Thibault Delavallée <tde@odoo.com> | 2019-05-20 15:10:54 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-07-02 10:39:25 +0000 |
| commit | 566244b47ba32f7d509fcb2ef15dcbed51009a0e (patch) | |
| tree | 588485eef127fecd4b558b8621b1f833a5658461 /addons/mail/wizard/mail_resend_message.py | |
| parent | 657adbe482604f822d6628ed30b349a2237faea4 (diff) | |
[REF] mail, sms: perform some guidelining (file move) and rename SMS composer model
Purpose is to prepare future improvements in mail and SMS module. In this
commit we apply some guidelines on XML Ids and file naming.
In mail cancel wizard code is separated from the resend one as they have
nothing in common.
More importantly ``sms.send_sms`` model is renamed to ``sms.composer`` to
avoid underscores (which is really really bad, take a look at
ir.config_parameter) and have a meaningful name.
Related to task 1922163
Linked to PR #34516
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
Co-Authored-By: Pierre Rousseau <pro@odoo.com>
Diffstat (limited to 'addons/mail/wizard/mail_resend_message.py')
| -rw-r--r-- | addons/mail/wizard/mail_resend_message.py | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/addons/mail/wizard/mail_resend_message.py b/addons/mail/wizard/mail_resend_message.py index bcff9dc9840..e5e4c069df1 100644 --- a/addons/mail/wizard/mail_resend_message.py +++ b/addons/mail/wizard/mail_resend_message.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import _, api, fields, models -from ast import literal_eval +from odoo import api, fields, models from odoo.exceptions import UserError + class MailResendMessage(models.TransientModel): _name = 'mail.resend.message' _description = 'Email resend wizard' @@ -100,38 +100,3 @@ class PartnerResend(models.TransientModel): resend = fields.Boolean(string="Send Again", default=True) resend_wizard_id = fields.Many2one('mail.resend.message', string="Resend wizard") message = fields.Char(string="Help message") - - -class MailCancelResend(models.TransientModel): - _name = 'mail.resend.cancel' - _description = 'Dismiss notification for resend by model' - - model = fields.Char(string='Model') - help_message = fields.Char(string='Help message', compute='_compute_help_message') - - @api.multi - @api.depends('model') - def _compute_help_message(self): - for wizard in self: - wizard.help_message = _("Are you sure you want to discard %s mail delivery failures. You won't be able to re-send these mails later!") % (wizard._context.get('unread_counter')) - - @api.multi - def cancel_resend_action(self): - author_id = self.env.user.partner_id.id - for wizard in self: - self._cr.execute(""" - SELECT notif.id, mes.id - FROM mail_message_res_partner_needaction_rel notif - JOIN mail_message mes - ON notif.mail_message_id = mes.id - WHERE notif.email_status IN ('bounce', 'exception') - AND mes.model = %s - AND mes.author_id = %s - """, (wizard.model, author_id)) - res = self._cr.fetchall() - notif_ids = [row[0] for row in res] - messages_ids = list(set([row[1] for row in res])) - if notif_ids: - self.env["mail.notification"].browse(notif_ids).sudo().write({'email_status': 'canceled'}) - self.env["mail.message"].browse(messages_ids)._notify_failure_update() - return {'type': 'ir.actions.act_window_close'} |
