diff --git a/addons/calendar_sms/views/calendar_views.xml b/addons/calendar_sms/views/calendar_views.xml index 84d07165dcf..37d20181e9a 100644 --- a/addons/calendar_sms/views/calendar_views.xml +++ b/addons/calendar_sms/views/calendar_views.xml @@ -5,7 +5,7 @@ diff --git a/addons/hr_presence/models/hr_employee.py b/addons/hr_presence/models/hr_employee.py index 6347555aaa9..a40dfd256eb 100644 --- a/addons/hr_presence/models/hr_employee.py +++ b/addons/hr_presence/models/hr_employee.py @@ -133,7 +133,7 @@ Please, take appropriate measures in order to carry out this work absence. Do not hesitate to contact your manager or the human resource department.""") return { "type": "ir.actions.act_window", - "res_model": "sms.send_sms", + "res_model": "sms.composer", "view_mode": 'form', "context": { 'active_id': self.id, diff --git a/addons/mail/__manifest__.py b/addons/mail/__manifest__.py index 80e5f0fff28..4fece68c14b 100644 --- a/addons/mail/__manifest__.py +++ b/addons/mail/__manifest__.py @@ -11,6 +11,7 @@ 'data': [ 'wizard/invite_view.xml', 'wizard/mail_compose_message_view.xml', + 'wizard/mail_resend_cancel_views.xml', 'wizard/mail_resend_message_views.xml', 'views/mail_message_subtype_views.xml', 'views/mail_tracking_views.xml', diff --git a/addons/mail/wizard/__init__.py b/addons/mail/wizard/__init__.py index e6ba124f4ae..7e0df4a2d19 100644 --- a/addons/mail/wizard/__init__.py +++ b/addons/mail/wizard/__init__.py @@ -3,6 +3,7 @@ from . import invite from . import mail_compose_message +from . import mail_resend_cancel from . import mail_resend_message from . import email_template_preview from . import base_module_uninstall diff --git a/addons/mail/wizard/mail_resend_cancel.py b/addons/mail/wizard/mail_resend_cancel.py new file mode 100644 index 00000000000..277ed8b96db --- /dev/null +++ b/addons/mail/wizard/mail_resend_cancel.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import _, api, fields, models + + +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'} diff --git a/addons/mail/wizard/mail_resend_cancel_views.xml b/addons/mail/wizard/mail_resend_cancel_views.xml new file mode 100644 index 00000000000..c8cc6632c75 --- /dev/null +++ b/addons/mail/wizard/mail_resend_cancel_views.xml @@ -0,0 +1,27 @@ + + + + mail.resend.cancel.view.form + mail.resend.cancel + + +
+ + +

If you want to re-send them, click Cancel now, then click on the notification and review them one by one by clicking on the red envelope next to each message.

+ Envelope Example +
+
+ +
+
+ + Discard mail delivery failures + mail.resend.cancel + ir.actions.act_window + form + new + +
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'} diff --git a/addons/mail/wizard/mail_resend_message_views.xml b/addons/mail/wizard/mail_resend_message_views.xml index 1ab5ea047f7..118660e232e 100644 --- a/addons/mail/wizard/mail_resend_message_views.xml +++ b/addons/mail/wizard/mail_resend_message_views.xml @@ -2,7 +2,7 @@ - mail.resend.message.form + mail.resend.message.view.form mail.resend.message @@ -31,23 +31,6 @@ - - mail.resend.cancel.form - mail.resend.cancel - - -
- - -

If you want to re-send them, click Cancel now, then click on the notification and review them one by one by clicking on the red envelope next to each message.

- Envelope Example -
-
- -
-
Resend mail mail.resend.message @@ -55,13 +38,5 @@ form new - - Discard mail delivery failures - mail.resend.cancel - ir.actions.act_window - form - new - -
diff --git a/addons/sms/__manifest__.py b/addons/sms/__manifest__.py index 574a13810d3..acc027d90d4 100644 --- a/addons/sms/__manifest__.py +++ b/addons/sms/__manifest__.py @@ -12,10 +12,10 @@ The service is provided by the In App Purchase Odoo platform. """, 'depends': ['base', 'iap', 'mail'], 'data': [ - 'wizard/send_sms_views.xml', + 'wizard/sms_composer_views.xml', 'views/res_config_settings_views.xml', 'views/res_partner_views.xml', - 'views/templates.xml', + 'views/assets.xml', ], 'qweb': [ 'static/src/xml/sms_widget.xml', diff --git a/addons/sms/views/templates.xml b/addons/sms/views/assets.xml similarity index 100% rename from addons/sms/views/templates.xml rename to addons/sms/views/assets.xml diff --git a/addons/sms/views/res_partner_views.xml b/addons/sms/views/res_partner_views.xml index 1773c31a30c..1a483568178 100644 --- a/addons/sms/views/res_partner_views.xml +++ b/addons/sms/views/res_partner_views.xml @@ -2,8 +2,8 @@ - - res.partner.form.send.sms + + res.partner.view.form.inherit.sms res.partner 10 @@ -14,7 +14,7 @@