From fbb9a25367a9abe58d5e8490e1a9678dec7274af Mon Sep 17 00:00:00 2001 From: Julien Banken Date: Mon, 5 Jul 2021 14:14:39 +0000 Subject: [PATCH 1/4] [IMP] mail: revamp the mail composer On the CRM module, the user can send an email to all the contacts associated to the leads matching some criteria by (1) displaying the list view, (2) applying a search filter, (3) clicking on the "EMAIL" button and (4) checking a checkbox on the mail composer to ask the server to use the active search. To do the same thing, the user can (1) display the list view, (2) apply a search filter, (3) select all the records and (3) click on the "EMAIL" button. To avoid redundancy and improve the usability of the composer, we will remove the search domain passing from the mail composer. Note that it will still be possible to pass a search domain programmatically. To improve the guidance of the mail composer, we will add helper messages, update the labels and move the options in a dedicated pane. The wording of the buttons will also be updated dynamically based on the selected options. Example: When the user enters something in the `mass_mailing_name` field to create a new mass mailing campaign from the new message, the label of the "Send" button will be set to "Send Mass Mailing" which gives more indication on what will happen when the user clicks on it. task-2523036 Part-of: odoo/odoo#71413 --- addons/mail/wizard/mail_compose_message.py | 4 +- .../wizard/mail_compose_message_views.xml | 80 ++++++++----------- .../wizard/mail_compose_message.py | 2 +- .../wizard/mail_compose_message_views.xml | 28 +++++++ 4 files changed, 64 insertions(+), 50 deletions(-) diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 003bb940514..3d91e4cde93 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -130,8 +130,8 @@ class MailComposer(models.TransientModel): string='Considers answers as new thread', help='Manage answers as new incoming emails instead of replies going to the same thread.') reply_to_mode = fields.Selection([ - ('update', 'Log in the original discussion thread'), - ('new', 'Redirect to another email address')], + ('update', 'Store email and replies in the chatter of each record'), + ('new', 'Collect replies on a specific email address')], string='Replies', compute='_compute_reply_to_mode', inverse='_inverse_reply_to_mode', help="Original Discussion: Answers go in the original document discussion thread. \n Another Email Address: Answers go to the email address mentioned in the tracking message-id instead of original document discussion thread. \n This has an impact on the generated message-id.") is_log = fields.Boolean('Log an Internal Note', diff --git a/addons/mail/wizard/mail_compose_message_views.xml b/addons/mail/wizard/mail_compose_message_views.xml index 603958d9b29..1771f53bf47 100644 --- a/addons/mail/wizard/mail_compose_message_views.xml +++ b/addons/mail/wizard/mail_compose_message_views.xml @@ -6,7 +6,7 @@ mail.compose.message -
+ @@ -15,66 +15,52 @@ - - - -
-

- - All records matching your current search filter will be mailed, - not only the ids selected in the list view. -
- The email will be sent for all the records selected in the list.
- Confirming this wizard will probably take a few minutes blocking your browser. -

-

- Only records checked in list view will be used.
- The email will be sent for all the records selected in the list. -

-

- - If you want to send it for all the records matching your search criterion, check this box : - - - If you want to use only selected records please uncheck this selection box : - - -

-
-
- - - - - +
+ + + + + +
+ + +
+ + + + + +
+
+ + + + + + + + +
- Resend mail + Sending Failures mail.resend.message ir.actions.act_window form diff --git a/addons/sms/wizard/sms_resend.py b/addons/sms/wizard/sms_resend.py index 804c3d19ba3..25882a91871 100644 --- a/addons/sms/wizard/sms_resend.py +++ b/addons/sms/wizard/sms_resend.py @@ -11,12 +11,12 @@ class SMSRecipient(models.TransientModel): sms_resend_id = fields.Many2one('sms.resend', required=True) notification_id = fields.Many2one('mail.notification', required=True, ondelete='cascade') - resend = fields.Boolean(string="Resend", default=True) + resend = fields.Boolean(string='Try Again', default=True) failure_type = fields.Selection( - related='notification_id.failure_type', related_sudo=True, readonly=True) + related='notification_id.failure_type', string='Error Message', related_sudo=True, readonly=True) partner_id = fields.Many2one('res.partner', 'Partner', related='notification_id.res_partner_id', readonly=True) - partner_name = fields.Char('Recipient', readonly='True') - sms_number = fields.Char('Number') + partner_name = fields.Char(string='Recipient Name', readonly='True') + sms_number = fields.Char(string='Phone Number') class SMSResend(models.TransientModel): @@ -40,7 +40,8 @@ class SMSResend(models.TransientModel): mail_message_id = fields.Many2one('mail.message', 'Message', readonly=True, required=True) recipient_ids = fields.One2many('sms.resend.recipient', 'sms_resend_id', string='Recipients') - has_cancel = fields.Boolean(compute='_compute_has_cancel') + can_cancel = fields.Boolean(compute='_compute_can_cancel') + can_resend = fields.Boolean(compute='_compute_can_resend') has_insufficient_credit = fields.Boolean(compute='_compute_has_insufficient_credit') has_unregistered_account = fields.Boolean(compute='_compute_has_unregistered_account') @@ -53,8 +54,12 @@ class SMSResend(models.TransientModel): self.has_insufficient_credit = self.recipient_ids.filtered(lambda p: p.failure_type == 'sms_credit') @api.depends("recipient_ids.resend") - def _compute_has_cancel(self): - self.has_cancel = self.recipient_ids.filtered(lambda p: not p.resend) + def _compute_can_cancel(self): + self.can_cancel = self.recipient_ids.filtered(lambda p: not p.resend) + + @api.depends('recipient_ids.resend') + def _compute_can_resend(self): + self.can_resend = any([recipient.resend for recipient in self.recipient_ids]) def _check_access(self): if not self.mail_message_id or not self.mail_message_id.model or not self.mail_message_id.res_id: diff --git a/addons/sms/wizard/sms_resend_views.xml b/addons/sms/wizard/sms_resend_views.xml index f9ce259bbec..3c70c37c4d4 100644 --- a/addons/sms/wizard/sms_resend_views.xml +++ b/addons/sms/wizard/sms_resend_views.xml @@ -7,29 +7,30 @@
- + - + -
From 93425828fc8f25a959f4771e2bce42ee4a44c505 Mon Sep 17 00:00:00 2001 From: Julien Banken Date: Thu, 23 Sep 2021 07:46:27 +0000 Subject: [PATCH 4/4] [IMP] mail,sms: remove create button from SMS and Mail failure view When the user opens the notification panel from the navbar and click on a notification indicating that an error occurs while sending an sms or an email, the user will be redirected to a new view listing the users that did not received the sms or the email. As it makes no sens to create a partner from that view, we will remove the "CREATE" button. task-2523036 Part-of: odoo/odoo#71413 --- .../static/src/models/notification_group/notification_group.js | 1 + .../static/src/models/notification_group/notification_group.js | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/mail/static/src/models/notification_group/notification_group.js b/addons/mail/static/src/models/notification_group/notification_group.js index 54cbb8c2036..48bccf5ee23 100644 --- a/addons/mail/static/src/models/notification_group/notification_group.js +++ b/addons/mail/static/src/models/notification_group/notification_group.js @@ -115,6 +115,7 @@ function factory(dependencies) { target: 'current', res_model: this.res_model, domain: [['message_has_error', '=', true]], + context: { create: false }, }, }); if (this.messaging.device.isMobile) { diff --git a/addons/sms/static/src/models/notification_group/notification_group.js b/addons/sms/static/src/models/notification_group/notification_group.js index a05a0e84a18..04a5b70055c 100644 --- a/addons/sms/static/src/models/notification_group/notification_group.js +++ b/addons/sms/static/src/models/notification_group/notification_group.js @@ -48,6 +48,7 @@ registerInstancePatchModel('mail.notification_group', 'sms/static/src/models/not target: 'current', res_model: this.res_model, domain: [['message_has_sms_error', '=', true]], + context: { create: false }, }, }); if (this.messaging.device.isMobile) {