Browse Source

[MIG] mail_tracking_mass_mailing: Migration to 12.0

pull/351/head
ernesto 6 years ago
committed by Jairo Llopis
parent
commit
2acfb25430
  1. 23
      mail_tracking_mass_mailing/README.rst
  2. 2
      mail_tracking_mass_mailing/__manifest__.py
  3. 5
      mail_tracking_mass_mailing/models/mail_mail.py
  4. 18
      mail_tracking_mass_mailing/models/mail_mass_mailing_contact.py
  5. 11
      mail_tracking_mass_mailing/readme/CONTRIBUTORS.rst
  6. 2
      mail_tracking_mass_mailing/readme/USAGE.rst
  7. 20
      mail_tracking_mass_mailing/static/description/index.html
  8. 5
      mail_tracking_mass_mailing/tests/test_mass_mailing.py
  9. 2
      mail_tracking_mass_mailing/views/mail_mail_statistics_view.xml
  10. 4
      mail_tracking_mass_mailing/views/mail_mass_mailing_contact_view.xml

23
mail_tracking_mass_mailing/README.rst

@ -14,13 +14,13 @@ Mail tracking for mass mailing
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/11.0/mail_tracking_mass_mailing
:target: https://github.com/OCA/social/tree/12.0/mail_tracking_mass_mailing
:alt: OCA/social :alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-11-0/social-11-0-mail_tracking_mass_mailing
:target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_tracking_mass_mailing
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/205/11.0
:target: https://runbot.odoo-community.org/runbot/205/12.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -50,7 +50,7 @@ From mass mailing contact, you can see:
- Email score, in order to clean up your lists from bad score emails - Email score, in order to clean up your lists from bad score emails
Mass mailing emails are sent only to recipients once. If you want to send Mass mailing emails are sent only to recipients once. If you want to send
eamils again to all the recipients, you must duplicate mass mailing.
emails again to all the recipients, you must duplicate mass mailing.
Bug Tracker Bug Tracker
=========== ===========
@ -58,7 +58,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_tracking_mass_mailing%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_tracking_mass_mailing%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -73,10 +73,13 @@ Authors
Contributors Contributors
~~~~~~~~~~~~ ~~~~~~~~~~~~
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>
* `Tecnativa <https://www.tecnativa.com>`_:
* Pedro M. Baeza
* Antonio Espinosa
* Vicent Cubells
* David Vidal
* Ernesto Tejeda
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -91,6 +94,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/11.0/mail_tracking_mass_mailing>`_ project on GitHub.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/12.0/mail_tracking_mass_mailing>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

2
mail_tracking_mass_mailing/__manifest__.py

@ -7,7 +7,7 @@
{ {
"name": "Mail tracking for mass mailing", "name": "Mail tracking for mass mailing",
"summary": "Improve mass mailing email tracking", "summary": "Improve mass mailing email tracking",
"version": "11.0.1.0.0",
"version": "12.0.1.0.0",
"category": "Social Network", "category": "Social Network",
"website": "https://github.com/OCA/social", "website": "https://github.com/OCA/social",
"author": "Tecnativa, " "author": "Tecnativa, "

5
mail_tracking_mass_mailing/models/mail_mail.py

@ -10,8 +10,7 @@ class MailMail(models.Model):
@api.model @api.model
def _tracking_email_prepare(self, partner, email): def _tracking_email_prepare(self, partner, email):
res = super(MailMail, self)._tracking_email_prepare(
partner, email)
res = super(MailMail, self)._tracking_email_prepare(partner, email)
res['mail_id_int'] = self.id res['mail_id_int'] = self.id
res['mass_mailing_id'] = self.mailing_id.id res['mass_mailing_id'] = self.mailing_id.id
res['mail_stats_id'] = self.statistics_ids[:1].id \ res['mail_stats_id'] = self.statistics_ids[:1].id \
@ -19,6 +18,6 @@ class MailMail(models.Model):
return res return res
@api.model @api.model
def _get_tracking_url(self, mail, partner=None):
def _get_tracking_url(self):
# Invalid this tracking image, we have other to do the same # Invalid this tracking image, we have other to do the same
return False return False

18
mail_tracking_mass_mailing/models/mail_mass_mailing_contact.py

@ -6,9 +6,9 @@ from odoo import models, api, fields
class MailMassMailingContact(models.Model): class MailMassMailingContact(models.Model):
_inherit = 'mail.mass_mailing.contact'
_name = 'mail.mass_mailing.contact'
_inherit = ['mail.mass_mailing.contact', 'mail.bounced.mixin']
email_bounced = fields.Boolean(string="Email bounced")
email_score = fields.Float( email_score = fields.Float(
string="Email score", readonly=True, store=False, string="Email score", readonly=True, store=False,
compute='_compute_email_score') compute='_compute_email_score')
@ -19,17 +19,3 @@ class MailMassMailingContact(models.Model):
for contact in self.filtered('email'): for contact in self.filtered('email'):
contact.email_score = self.env['mail.tracking.email'].\ contact.email_score = self.env['mail.tracking.email'].\
email_score_from_email(contact.email) email_score_from_email(contact.email)
@api.multi
def email_bounced_set(self, tracking_emails, reason, event=None):
contacts = self.filtered(lambda r: not r.email_bounced)
return contacts.write({'email_bounced': True})
@api.multi
def write(self, vals):
email = vals.get('email')
if email is not None:
vals['email_bounced'] = (
bool(email) and
self.env['mail.tracking.email'].email_is_bounced(email))
return super(MailMassMailingContact, self).write(vals)

11
mail_tracking_mass_mailing/readme/CONTRIBUTORS.rst

@ -1,4 +1,7 @@
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>
* `Tecnativa <https://www.tecnativa.com>`_:
* Pedro M. Baeza
* Antonio Espinosa
* Vicent Cubells
* David Vidal
* Ernesto Tejeda

2
mail_tracking_mass_mailing/readme/USAGE.rst

@ -7,4 +7,4 @@ From mass mailing contact, you can see:
- Email score, in order to clean up your lists from bad score emails - Email score, in order to clean up your lists from bad score emails
Mass mailing emails are sent only to recipients once. If you want to send Mass mailing emails are sent only to recipients once. If you want to send
eamils again to all the recipients, you must duplicate mass mailing.
emails again to all the recipients, you must duplicate mass mailing.

20
mail_tracking_mass_mailing/static/description/index.html

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/11.0/mail_tracking_mass_mailing"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-11-0/social-11-0-mail_tracking_mass_mailing"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/12.0/mail_tracking_mass_mailing"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_tracking_mass_mailing"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Links mail statistics objects with mail tracking objects.</p> <p>Links mail statistics objects with mail tracking objects.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
@ -397,14 +397,14 @@ ul.auto-toc {
<p>From mass mailing contact, you can see: <p>From mass mailing contact, you can see:
- Email score, in order to clean up your lists from bad score emails</p> - Email score, in order to clean up your lists from bad score emails</p>
<p>Mass mailing emails are sent only to recipients once. If you want to send <p>Mass mailing emails are sent only to recipients once. If you want to send
eamils again to all the recipients, you must duplicate mass mailing.</p>
emails again to all the recipients, you must duplicate mass mailing.</p>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1> <h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_tracking_mass_mailing%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_tracking_mass_mailing%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -418,10 +418,14 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id6">Contributors</a></h2> <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Pedro M. Baeza &lt;<a class="reference external" href="mailto:pedro.baeza&#64;tecnativa.com">pedro.baeza&#64;tecnativa.com</a>&gt;</li>
<li>Antonio Espinosa &lt;<a class="reference external" href="mailto:antonio.espinosa&#64;tecnativa.com">antonio.espinosa&#64;tecnativa.com</a>&gt;</li>
<li>Vicent Cubells &lt;<a class="reference external" href="mailto:vicent.cubells&#64;tecnativa.com">vicent.cubells&#64;tecnativa.com</a>&gt;</li>
<li>David Vidal &lt;<a class="reference external" href="mailto:david.vidal&#64;tecnativa.com">david.vidal&#64;tecnativa.com</a>&gt;</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Pedro M. Baeza</li>
<li>Antonio Espinosa</li>
<li>Vicent Cubells</li>
<li>David Vidal</li>
<li>Ernesto Tejeda</li>
</ul>
</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@ -431,7 +435,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/11.0/mail_tracking_mass_mailing">OCA/social</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/12.0/mail_tracking_mass_mailing">OCA/social</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

5
mail_tracking_mass_mailing/tests/test_mass_mailing.py

@ -8,7 +8,7 @@ import mock
from odoo.tools import mute_logger from odoo.tools import mute_logger
from odoo.tests.common import at_install, post_install, TransactionCase from odoo.tests.common import at_install, post_install, TransactionCase
mock_send_email = ('odoo.addons.base.ir.ir_mail_server.'
mock_send_email = ('odoo.addons.base.models.ir_mail_server.'
'IrMailServer.send_email') 'IrMailServer.send_email')
@ -32,8 +32,7 @@ class TestMassMailing(TransactionCase):
'mailing_model_id': self.env.ref( 'mailing_model_id': self.env.ref(
'mass_mailing.model_mail_mass_mailing_contact' 'mass_mailing.model_mail_mass_mailing_contact'
).id, ).id,
'mailing_domain': "[('list_ids', '=', %d), "
"('opt_out', '=', False)]" % self.list.id,
'mailing_domain': "[('list_ids', 'in', %d)]" % self.list.id,
'contact_list_ids': [(6, False, [self.list.id])], 'contact_list_ids': [(6, False, [self.list.id])],
'body_html': '<p>Test email body</p>', 'body_html': '<p>Test email body</p>',
'reply_to_mode': 'email', 'reply_to_mode': 'email',

2
mail_tracking_mass_mailing/views/mail_mail_statistics_view.xml

@ -9,7 +9,7 @@
<field name="model">mail.mail.statistics</field> <field name="model">mail.mail.statistics</field>
<field name="inherit_id" ref="mass_mailing.view_mail_mail_statistics_form"/> <field name="inherit_id" ref="mass_mailing.view_mail_mail_statistics_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//form" position="inside">
<xpath expr="//form/sheet" position="inside">
<group> <group>
<field name="mail_tracking_id" /> <field name="mail_tracking_id" />
</group> </group>

4
mail_tracking_mass_mailing/views/mail_mass_mailing_contact_view.xml

@ -9,7 +9,7 @@
<field name="model">mail.mass_mailing.contact</field> <field name="model">mail.mass_mailing.contact</field>
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_contact_tree"/> <field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_contact_tree"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="opt_out" position="after">
<field name="is_blacklisted" position="after">
<field name="email_bounced"/> <field name="email_bounced"/>
<field name="email_score" widget="progressbar"/> <field name="email_score" widget="progressbar"/>
</field> </field>
@ -21,7 +21,7 @@
<field name="model">mail.mass_mailing.contact</field> <field name="model">mail.mass_mailing.contact</field>
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_contact_search"/> <field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_contact_search"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<filter name="not_opt_out" position="after">
<filter name="not_blacklisted" position="after">
<filter string="Email bounced" name="email_bounced" <filter string="Email bounced" name="email_bounced"
domain="[('email_bounced', '=', True)]"/> domain="[('email_bounced', '=', True)]"/>
</filter> </filter>

Loading…
Cancel
Save