* [ADD] mass_mailing_resend
Resend mass mailings
====================
A frequent need for users of mass mailings is to resend one mailing that has
already been sent in the past to new recipients that haven't received yet that
mail. But the problem is to know which are the applicable ones.
Odoo already includes a method in its mass mailing logic that avoids to resend
the same mail 2 times for one mass mailing, and for v9, there was a trick that
allows to modify the state of a mass mailing from kanban view, covering the
need.
But now on v10 both status bar in form view and dragging between states in
kanban are not allowed.
This module introduces a button to restart a mass mailing to draft state,
allowing you to reevaluate the sending domain or list for performing again
the mailing.
Usage
=====
* Go to *Mass mailing > Mailings > Mass Mailings*.
* Click on one record that is done or create a new one and send it.
* You will see a button called "Resend".
* If you click on it, mass mailing will be set to Draft again.
Known issues / Roadmap
======================
* Add an indicator / filter for knowing resent mailings.
* Include information on the number of new recipients to be sent on the
resending (through `get_remaining_recipients` method).
Without this patch, users without access to reading and editing mass mailing contact records are now unable to change a partner's name or email. They'd recieve an exception such as:
AccessError: Sorry, you are not allowed to access this document. Only users with the following access level are currently allowed to do that:
- Mass Mailing/User
(Document model: mail.mass_mailing.contact)
Restrictive ACLs shouldn't restrict normal user operation nor DB consistency, so using sudo mode now and testing behavior.
When this method is called without an event (a.k.a. `event=None`), this method produces the following error:
```
Traceback (most recent call last):
File "/opt/odoo/auto/addons/mail/models/mail_mail.py", line 278, in send
res = IrMailServer.send_email(msg, mail_server_id=mail.mail_server_id.id)
File "/opt/odoo/auto/addons/mail_tracking/models/ir_mail_server.py", line 88, in send_email
tracking_email.smtp_error(self, smtp_server_used, e)
File "/opt/odoo/auto/addons/mail_tracking/models/mail_tracking_email.py", line 213, in smtp_error
self.sudo()._partners_email_bounced_set('error')
File "/opt/odoo/auto/addons/mail_tracking/models/mail_tracking_email.py", line 203, in
_partners_email_bounced_set
]).email_bounced_set(self, reason, event=event)
File "/opt/odoo/auto/addons/mail_tracking_mailgun/models/res_partner.py", line 22, in
email_bounced_set
self._email_bounced_set(reason, event)
File "/opt/odoo/auto/addons/mail_tracking_mailgun/models/res_partner.py", line 33, in
_email_bounced_set
event['Message-Id'] or '') TypeError: 'NoneType' object has no attribute '__getitem__'
```
So, we now assume we do not always have an event.
When creating digest records within the context of mail composer
(and possibly other contexts) you'll have a `default_template_id`
key in the context which is going to override our safe default.
This is going to break email generation because the template
will be completely wrong and unpredictable. Lesson learned :)
Depending on the request might fail
nevertheless the website should be there to be found.
Fallback to search and use it if possible for digest' site name
Without this commit, followers are NEVER notified when a message is directly posted on the tracker (without click to open the mail compose message form)