[MIG] mass_mailing_resend: Migration to 15.0

TT40296
This commit is contained in:
Víctor Martínez 2022-11-03 15:12:03 +01:00
parent 09da2fa601
commit b64d38aa6c
7 changed files with 63 additions and 23 deletions

View File

@ -14,13 +14,13 @@ Resend mass mailings
: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/14.0/mass_mailing_resend
:target: https://github.com/OCA/social/tree/15.0/mass_mailing_resend
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-14-0/social-14-0-mass_mailing_resend
:target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mass_mailing_resend
: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/14.0
:target: https://runbot.odoo-community.org/runbot/205/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@ -67,7 +67,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:%20mass_mailing_resend%0Aversion:%2014.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:%20mass_mailing_resend%0Aversion:%2015.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.
@ -108,6 +108,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-pedrobaeza|
This module is part of the `OCA/social <https://github.com/OCA/social/tree/14.0/mass_mailing_resend>`_ project on GitHub.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mass_mailing_resend>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -4,7 +4,7 @@
{
"name": "Resend mass mailings",
"version": "14.0.1.0.0",
"version": "15.0.1.0.0",
"category": "Marketing",
"website": "https://github.com/OCA/social",
"author": "Tecnativa, Odoo Community Association (OCA)",

View File

@ -21,12 +21,12 @@ msgstr ""
msgid ""
"<i class=\"fa fa-info-circle\"/> New sending will be done only to not sent/"
"new recipients. If you want to resend again the mass mailing to already sent "
"recipients, click on <b>Emails Sent</b> smart-button for removing the "
"recipients, click on <b>Sent</b> smart-button for removing the "
"existing record(s)."
msgstr ""
"<i class=\"fa fa-info-circle\"/> El nuevo envío se realizará solo a los "
"destinatarios no enviados/nuevos. Si quiere reenviar otra vez el correo "
"masivo a destinatarios ya enviados, pulse en el botón <b>Correos enviados</"
"masivo a destinatarios ya enviados, pulse en el botón <b>Enviados</"
"b> para eliminar el/los registro/s existentes."
#. module: mass_mailing_resend

View File

@ -18,7 +18,7 @@ msgstr ""
msgid ""
"<i class=\"fa fa-info-circle\"/> New sending will be done only to not "
"sent/new recipients. If you want to resend again the mass mailing to already"
" sent recipients, click on <b>Emails Sent</b> smart-button for removing the "
" sent recipients, click on <b>Sent</b> smart-button for removing the "
"existing record(s)."
msgstr ""

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>Resend mass mailings</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="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.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/mass_mailing_resend"><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-mass_mailing_resend"><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><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.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/15.0/mass_mailing_resend"><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-15-0/social-15-0-mass_mailing_resend"><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/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>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 havent received yet that
mail. But the problem is to know which are the applicable ones.</p>
@ -416,7 +416,7 @@ resending (through <cite>get_remaining_recipients</cite> method).</li>
<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:%20mass_mailing_resend%0Aversion:%2014.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:%20mass_mailing_resend%0Aversion:%2015.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">
@ -446,7 +446,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/14.0/mass_mailing_resend">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/15.0/mass_mailing_resend">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,17 +1,29 @@
# Copyright 2017-2020 Tecnativa - Pedro M. Baeza
# Copyright 2022 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import exceptions
from odoo.tests import common
class TestMassMailingResend(common.SavepointCase):
class TestMassMailingResend(common.TransactionCase):
@classmethod
def setUpClass(cls):
super(TestMassMailingResend, cls).setUpClass()
super().setUpClass()
cls.list = cls.env["mailing.list"].create({"name": "Test list"})
cls.contact1 = cls.env["mailing.contact"].create(
{"name": "Contact 1", "email": "email1@test.com"}
{
"name": "Contact 1",
"email": "email1@test.com",
"list_ids": [[6, 0, [cls.list.id]]],
}
)
cls.contact2 = cls.env["mailing.contact"].create(
{
"name": "Contact 2",
"email": "email2@test.com",
"list_ids": [[6, 0, [cls.list.id]]],
}
)
cls.mass_mailing = cls.env["mailing.mailing"].create(
{
@ -20,16 +32,32 @@ class TestMassMailingResend(common.SavepointCase):
"mailing_model_id": cls.env.ref("mass_mailing.model_mailing_list").id,
"contact_list_ids": [(6, 0, cls.list.ids)],
"subject": "Mailing test",
"reply_to_mode": "thread",
}
)
cls.mm_cron = cls.env.ref("mass_mailing.ir_cron_mass_mailing_queue").sudo()
def test_resend_error(self):
with self.assertRaises(exceptions.UserError):
self.mass_mailing.button_draft()
def test_resend(self):
self.mass_mailing.state = "done" # Force state
def _mailing_action_done(self):
self.mass_mailing.action_launch()
self.mm_cron.method_direct_trigger()
def test_resend_process(self):
# Send mailing
self._mailing_action_done()
self.assertEqual(self.mass_mailing.state, "done")
self.assertEqual(self.mass_mailing.sent, 2)
# Simulate that an email has not been sent
self.mass_mailing.mailing_trace_ids.filtered(
lambda x: x.email == self.contact2.email
).unlink()
self.assertEqual(self.mass_mailing.sent, 1)
# Back to draft
self.mass_mailing.button_draft()
self.assertEqual(self.mass_mailing.state, "draft")
# Send mailing again (already sent not sent again)
self._mailing_action_done()
self.assertEqual(self.mass_mailing.state, "done")
self.assertEqual(self.mass_mailing.sent, 2)

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.ui.view" id="view_mail_mass_mailing_form">
<record id="view_mail_mass_mailing_form" model="ir.ui.view">
<field name="model">mailing.mailing</field>
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_form" />
<field name="arch" type="xml">
@ -22,7 +21,7 @@
<i
class="fa fa-info-circle"
/> New sending will be done only to not sent/new recipients. If you want to resend again the mass mailing to already sent recipients, click on <b
>Emails Sent</b> smart-button for removing the existing record(s).
>Sent</b> smart-button for removing the existing record(s).
</p>
</div>
</header>
@ -31,5 +30,18 @@
</div>
</field>
</record>
<record id="mailing_mailing_view_form_full_width" model="ir.ui.view">
<field name="model">mailing.mailing</field>
<field
name="inherit_id"
ref="mass_mailing.mailing_mailing_view_form_full_width"
/>
<field name="arch" type="xml">
<button name="action_view_traces_sent" position="attributes">
<attribute
name="attrs"
>{'invisible': [('state', 'in', ('draft','test')),('sent', '=', 0)]}</attribute>
</button>
</field>
</record>
</odoo>