[MIG] mail_tracking_mass_mailing: Migration to v14.0

pull/1248/head
Carlos Roca 2021-07-22 11:28:44 +02:00 committed by David
parent 46f0955911
commit 45bd999b2e
21 changed files with 57 additions and 79 deletions

View File

@ -14,13 +14,13 @@ Mail tracking for mass mailing
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/13.0/mail_tracking_mass_mailing
:target: https://github.com/OCA/social/tree/14.0/mail_tracking_mass_mailing
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-13-0/social-13-0-mail_tracking_mass_mailing
:target: https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_tracking_mass_mailing
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/205/13.0
:target: https://runbot.odoo-community.org/runbot/205/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@ -58,7 +58,7 @@ Bug Tracker
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.
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:%2013.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:%2014.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.
@ -80,6 +80,7 @@ Contributors
* Vicent Cubells
* David Vidal
* Ernesto Tejeda
* Carlos Roca
Maintainers
~~~~~~~~~~~
@ -94,6 +95,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/13.0/mail_tracking_mass_mailing>`_ project on GitHub.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/14.0/mail_tracking_mass_mailing>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -1,5 +1,5 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

View File

@ -1,16 +1,16 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2017 David Vidal - <david.vidal@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# Copyright 2017 Tecnativa - David Vidal
# Copyright 2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Mail tracking for mass mailing",
"summary": "Improve mass mailing email tracking",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"category": "Social Network",
"website": "https://github.com/OCA/social",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,

View File

@ -1,5 +1,5 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
@ -14,7 +14,7 @@ _logger = logging.getLogger(__name__)
def pre_init_hook(cr):
if column_add_with_value:
_logger.info("Creating mailing_contact.email_score column " "with value 50.0")
_logger.info("Creating mailing_contact.email_score column with value 50.0")
column_add_with_value(
cr, "mailing_contact", "email_score", "double precision", 50.0
)

View File

@ -118,6 +118,3 @@ msgstr "Esdeveniments de seguiment"
#: model_terms:ir.ui.view,arch_db:mail_tracking_mass_mailing.mailing_trace_view_form
msgid "User agent"
msgstr "Aplicació de l'usuari"
#~ msgid "Email Statistics"
#~ msgstr "Estadístiques de correu electrònic"

View File

@ -118,6 +118,3 @@ msgstr "Verfolge Vorkommnisse"
#: model_terms:ir.ui.view,arch_db:mail_tracking_mass_mailing.mailing_trace_view_form
msgid "User agent"
msgstr "Benutzervertreter"
#~ msgid "Email Statistics"
#~ msgstr "Email-Statistiken"

View File

@ -118,6 +118,3 @@ msgstr "Eventos de seguimiento"
#: model_terms:ir.ui.view,arch_db:mail_tracking_mass_mailing.mailing_trace_view_form
msgid "User agent"
msgstr "Aplicación del usuario"
#~ msgid "Email Statistics"
#~ msgstr "Estadísticas de email"

View File

@ -118,6 +118,3 @@ msgstr "Suivi du courriel: évènements"
#: model_terms:ir.ui.view,arch_db:mail_tracking_mass_mailing.mailing_trace_view_form
msgid "User agent"
msgstr "Navigateur"
#~ msgid "Email Statistics"
#~ msgstr "Statistiques de courriel"

View File

@ -119,6 +119,3 @@ msgstr "Eventos de rastreamento"
#: model_terms:ir.ui.view,arch_db:mail_tracking_mass_mailing.mailing_trace_view_form
msgid "User agent"
msgstr "Agente do utilizador"
#~ msgid "Email Statistics"
#~ msgstr "Estatísticas de Email"

View File

@ -119,6 +119,3 @@ msgstr "Sledilni dogodki"
#: model_terms:ir.ui.view,arch_db:mail_tracking_mass_mailing.mailing_trace_view_form
msgid "User agent"
msgstr "Uporabnikov odjemalec"
#~ msgid "Email Statistics"
#~ msgstr "Statistika e-pošte"

View File

@ -1,5 +1,5 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import mail_mail

View File

@ -1,5 +1,5 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
@ -10,7 +10,7 @@ class MailMail(models.Model):
@api.model
def _tracking_email_prepare(self, partner, email):
res = super(MailMail, self)._tracking_email_prepare(partner, email)
res = super()._tracking_email_prepare(partner, email)
res["mail_id_int"] = self.id
res["mass_mailing_id"] = self.mailing_id.id
res["mail_stats_id"] = (

View File

@ -1,5 +1,5 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
@ -23,7 +23,7 @@ class MailTrackingEmail(models.Model):
@api.model
def create(self, vals):
tracking = super(MailTrackingEmail, self).create(vals)
tracking = super().create(vals)
# Link mail statistics with this tracking
if tracking.mail_stats_id:
tracking.mail_stats_id.write(self._statistics_link_prepare(tracking))
@ -41,14 +41,12 @@ class MailTrackingEmail(models.Model):
).email_bounced_set(self, reason, event=event)
def smtp_error(self, mail_server, smtp_server, exception):
res = super(MailTrackingEmail, self).smtp_error(
mail_server, smtp_server, exception
)
res = super().smtp_error(mail_server, smtp_server, exception)
self._contacts_email_bounced_set("error")
return res
def event_create(self, event_type, metadata):
res = super(MailTrackingEmail, self).event_create(event_type, metadata)
res = super().event_create(event_type, metadata)
if event_type in {"hard_bounce", "spam", "reject"}:
self._contacts_email_bounced_set(event_type)
return res

View File

@ -1,5 +1,5 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
@ -18,7 +18,7 @@ class MailTrackingEvent(models.Model):
@api.model
def process_open(self, tracking_email, metadata):
res = super(MailTrackingEvent, self).process_open(tracking_email, metadata)
res = super().process_open(tracking_email, metadata)
mail_mail_stats = self.sudo().env["mailing.trace"]
mail_mail_stats.set_opened(mail_mail_ids=[tracking_email.mail_id_int])
return res
@ -29,28 +29,24 @@ class MailTrackingEvent(models.Model):
@api.model
def process_hard_bounce(self, tracking_email, metadata):
res = super(MailTrackingEvent, self).process_hard_bounce(
tracking_email, metadata
)
res = super().process_hard_bounce(tracking_email, metadata)
self._tracking_set_bounce(tracking_email, metadata)
return res
@api.model
def process_soft_bounce(self, tracking_email, metadata):
res = super(MailTrackingEvent, self).process_soft_bounce(
tracking_email, metadata
)
res = super().process_soft_bounce(tracking_email, metadata)
self._tracking_set_bounce(tracking_email, metadata)
return res
@api.model
def process_reject(self, tracking_email, metadata):
res = super(MailTrackingEvent, self).process_reject(tracking_email, metadata)
res = super().process_reject(tracking_email, metadata)
self._tracking_set_bounce(tracking_email, metadata)
return res
@api.model
def process_spam(self, tracking_email, metadata):
res = super(MailTrackingEvent, self).process_spam(tracking_email, metadata)
res = super().process_spam(tracking_email, metadata)
self._tracking_set_bounce(tracking_email, metadata)
return res

View File

@ -1,5 +1,5 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models

View File

@ -1,5 +1,5 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models

View File

@ -5,3 +5,4 @@
* Vicent Cubells
* David Vidal
* Ernesto Tejeda
* Carlos Roca

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Mail tracking for mass mailing</title>
<style type="text/css">
@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! 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/13.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-13-0/social-13-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/13.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/14.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-14-0/social-14-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/14.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><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
@ -404,7 +404,7 @@ emails again to all the recipients, you must duplicate mass mailing.</p>
<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.
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:%2013.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:%2014.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>
</div>
<div class="section" id="credits">
@ -424,6 +424,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Vicent Cubells</li>
<li>David Vidal</li>
<li>Ernesto Tejeda</li>
<li>Carlos Roca</li>
</ul>
</li>
</ul>
@ -435,7 +436,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
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/13.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/14.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>
</div>
</div>

View File

@ -1,5 +1,5 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_mass_mailing

View File

@ -1,22 +1,21 @@
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# Copyright 2017 David Vidal - <david.vidal@tecnativa.com>
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# Copyright 2017 Tecnativa - David Vidal
# Copyright 2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import mock
from unittest import mock
from odoo.tests.common import TransactionCase, at_install, post_install
from odoo.tests.common import TransactionCase, tagged
from odoo.tools import mute_logger
mock_send_email = "odoo.addons.base.models.ir_mail_server." "IrMailServer.send_email"
mock_send_email = "odoo.addons.base.models.ir_mail_server.IrMailServer.send_email"
@at_install(False)
@post_install(True)
@tagged("-at_install", "post_install")
class TestMassMailing(TransactionCase):
def setUp(self, *args, **kwargs):
super(TestMassMailing, self).setUp(*args, **kwargs)
super().setUp(*args, **kwargs)
self.list = self.env["mailing.list"].create({"name": "Test mail tracking"})
self.list.name = "{} #{}".format(self.list.name, self.list.id)
self.contact_a = self.env["mailing.contact"].create(

View File

@ -4,10 +4,10 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<odoo>
<record model="ir.ui.view" id="view_mail_mass_mailing_contact_tree">
<record model="ir.ui.view" id="mailing_contact_view_tree">
<field name="name">Add email score and stars</field>
<field name="model">mailing.contact</field>
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_contact_tree" />
<field name="inherit_id" ref="mass_mailing.mailing_contact_view_tree" />
<field name="arch" type="xml">
<field name="is_blacklisted" position="after">
<field name="email_bounced" />
@ -16,10 +16,10 @@
</field>
</record>
<record model="ir.ui.view" id="view_mail_mass_mailing_contact_search">
<record model="ir.ui.view" id="mailing_contact_view_search">
<field name="name">Filter bounced contacts</field>
<field name="model">mailing.contact</field>
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_contact_search" />
<field name="inherit_id" ref="mass_mailing.mailing_contact_view_search" />
<field name="arch" type="xml">
<filter name="filter_not_email_bl" position="after">
<filter