[16.0][MIG] mass_mailing_list_dynamic: Migration to 16.0

pull/1089/head
Minh Chien 2023-03-06 11:07:59 +07:00 committed by Pedro M. Baeza
parent 27045d08f5
commit 5f2bde737e
8 changed files with 62 additions and 25 deletions

View File

@ -14,14 +14,14 @@ Dynamic Mass Mailing Lists
: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/14.0/mass_mailing_list_dynamic :target: https://github.com/OCA/social/tree/16.0/mass_mailing_list_dynamic
: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-14-0/social-14-0-mass_mailing_list_dynamic :target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mass_mailing_list_dynamic
: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/runboat-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/205/14.0 :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/social&target_branch=16.0
:alt: Try me on Runbot :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -88,7 +88,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:%20mass_mailing_list_dynamic%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_list_dynamic%0Aversion:%2016.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.
@ -115,6 +115,19 @@ Contributors
* Jared Kipe <jared@hibou.io> * Jared Kipe <jared@hibou.io>
* `Dynapps N.V. <https://www.dynapps.be>`_:
* Xander De Jaegere
* `Trobz <https://trobz.com>`_:
* Nguyễn Minh Chiến <chien@trobz.com>
Other credits
~~~~~~~~~~~~~
The migration of this module from 15.0 to 16.0 was financially supported by Camptocamp
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -128,6 +141,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/14.0/mass_mailing_list_dynamic>`_ project on GitHub. This module is part of the `OCA/social <https://github.com/OCA/social/tree/16.0/mass_mailing_list_dynamic>`_ 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.

View File

@ -5,7 +5,7 @@
{ {
"name": "Dynamic Mass Mailing Lists", "name": "Dynamic Mass Mailing Lists",
"summary": "Mass mailing lists that get autopopulated", "summary": "Mass mailing lists that get autopopulated",
"version": "15.0.1.0.0", "version": "16.0.1.0.0",
"category": "Marketing", "category": "Marketing",
"website": "https://github.com/OCA/social", "website": "https://github.com/OCA/social",
"author": "Tecnativa, Odoo Community Association (OCA)", "author": "Tecnativa, Odoo Community Association (OCA)",

View File

@ -65,7 +65,7 @@ class MassMailingList(models.Model):
Contact.create(vals_list) Contact.create(vals_list)
one.is_synced = True one.is_synced = True
# Invalidate cached contact count # Invalidate cached contact count
self.invalidate_cache(["contact_count"], dynamic.ids) dynamic.invalidate_recordset(["contact_count"])
@api.onchange("dynamic", "sync_method", "sync_domain") @api.onchange("dynamic", "sync_method", "sync_domain")
def _onchange_dynamic(self): def _onchange_dynamic(self):

View File

@ -13,3 +13,7 @@
* `Dynapps N.V. <https://www.dynapps.be>`_: * `Dynapps N.V. <https://www.dynapps.be>`_:
* Xander De Jaegere * Xander De Jaegere
* `Trobz <https://trobz.com>`_:
* Nguyễn Minh Chiến <chien@trobz.com>

View File

@ -0,0 +1 @@
The migration of this module from 15.0 to 16.0 was financially supported by Camptocamp

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <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>Dynamic Mass Mailing Lists</title> <title>Dynamic Mass Mailing Lists</title>
<style type="text/css"> <style type="text/css">
@ -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/14.0/mass_mailing_list_dynamic"><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_list_dynamic"><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="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/16.0/mass_mailing_list_dynamic"><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-16-0/social-16-0-mass_mailing_list_dynamic"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/social&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Without this addon you have to choose between providing a dynamic domain and <p>Without this addon you have to choose between providing a dynamic domain and
letting your mass mailings reach all partners that match it.</p> letting your mass mailings reach all partners that match it.</p>
<p>This addon allows you to create dynamic mailing lists, so you can now benefit <p>This addon allows you to create dynamic mailing lists, so you can now benefit
@ -381,7 +381,8 @@ from both things.</p>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul> <li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li> <li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li> <li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li> <li><a class="reference internal" href="#other-credits" id="id7">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -436,7 +437,7 @@ list.</p>
<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:%20mass_mailing_list_dynamic%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_list_dynamic%0Aversion:%2016.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">
@ -449,8 +450,9 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</div> </div>
<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>
<li><p class="first"><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:</p>
<ul class="simple"> <ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Jairo Llopis</li> <li>Jairo Llopis</li>
<li>Pedro M. Baeza</li> <li>Pedro M. Baeza</li>
<li>David Vidal</li> <li>David Vidal</li>
@ -458,20 +460,37 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Víctor Martínez</li> <li>Víctor Martínez</li>
</ul> </ul>
</li> </li>
<li><a class="reference external" href="https://hibou.io">Hibou Corp.</a>:<ul> <li><p class="first"><a class="reference external" href="https://hibou.io">Hibou Corp.</a>:</p>
<ul class="simple">
<li>Jared Kipe &lt;<a class="reference external" href="mailto:jared&#64;hibou.io">jared&#64;hibou.io</a>&gt;</li> <li>Jared Kipe &lt;<a class="reference external" href="mailto:jared&#64;hibou.io">jared&#64;hibou.io</a>&gt;</li>
</ul> </ul>
</li> </li>
<li><p class="first"><a class="reference external" href="https://www.dynapps.be">Dynapps N.V.</a>:</p>
<ul class="simple">
<li>Xander De Jaegere</li>
</ul>
</li>
<li><p class="first"><a class="reference external" href="https://trobz.com">Trobz</a>:</p>
<blockquote>
<ul class="simple">
<li>Nguyễn Minh Chiến &lt;<a class="reference external" href="mailto:chien&#64;trobz.com">chien&#64;trobz.com</a>&gt;</li>
</ul>
</blockquote>
</li>
</ul> </ul>
</div> </div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id7">Other credits</a></h2>
<p>The migration of this module from 15.0 to 16.0 was financially supported by Camptocamp</p>
</div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2> <h2><a class="toc-backref" href="#id8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p> <p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<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/14.0/mass_mailing_list_dynamic">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/16.0/mass_mailing_list_dynamic">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>

View File

@ -2,7 +2,7 @@
# Copyright 2020 Hibou Corp. - Jared Kipe # Copyright 2020 Hibou Corp. - Jared Kipe
# Copyright 2021 Tecnativa - Víctor Martínez # Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from mock import patch from unittest.mock import patch
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
from odoo.tests import common, tagged from odoo.tests import common, tagged
@ -51,12 +51,12 @@ class DynamicListCase(common.TransactionCase):
contact0 = Contact.create( contact0 = Contact.create(
{"list_ids": [(4, self.list.id)], "partner_id": self.partners[0].id} {"list_ids": [(4, self.list.id)], "partner_id": self.partners[0].id}
) )
self.list.flush() self.list.flush_recordset()
self.assertEqual(self.list.contact_count, 1) self.assertEqual(self.list.contact_count, 1)
# Set list as add-synced # Set list as add-synced
self.list.dynamic = True self.list.dynamic = True
self.list.action_sync() self.list.action_sync()
self.list.flush() self.list.flush_recordset()
self.assertEqual(self.list.contact_count, 4) self.assertEqual(self.list.contact_count, 4)
self.assertTrue(contact0.exists()) self.assertTrue(contact0.exists())
# Set list as full-synced # Set list as full-synced
@ -68,7 +68,7 @@ class DynamicListCase(common.TransactionCase):
] ]
).unlink() ).unlink()
self.list.action_sync() self.list.action_sync()
self.list.flush() self.list.flush_recordset()
self.assertEqual(self.list.contact_count, 3) self.assertEqual(self.list.contact_count, 3)
self.assertFalse(contact0.exists()) self.assertFalse(contact0.exists())
# Cannot add or edit contacts in fully synced lists # Cannot add or edit contacts in fully synced lists
@ -93,7 +93,7 @@ class DynamicListCase(common.TransactionCase):
def test_sync_when_sending_mail(self): def test_sync_when_sending_mail(self):
"""Check that list in synced when sending a mass mailing.""" """Check that list in synced when sending a mass mailing."""
self.list.action_sync() self.list.action_sync()
self.list.flush() self.list.flush_recordset()
self.assertEqual(self.list.contact_count, 5) self.assertEqual(self.list.contact_count, 5)
# Create a new partner # Create a new partner
self.partners.create( self.partners.create(
@ -107,7 +107,7 @@ class DynamicListCase(common.TransactionCase):
with patch("odoo.addons.mail.models.mail_mail.MailMail.send") as s: with patch("odoo.addons.mail.models.mail_mail.MailMail.send") as s:
self.mail.action_send_mail() self.mail.action_send_mail()
self.assertEqual(1, s.call_count) self.assertEqual(1, s.call_count)
self.list.flush() self.list.flush_recordset()
self.assertEqual(6, self.list.contact_count) self.assertEqual(6, self.list.contact_count)
def test_load_filter(self): def test_load_filter(self):

View File

@ -35,7 +35,7 @@
/> />
</div> </div>
</group> </group>
<group attrs="{'invisible': [('dynamic', '=', False)]}"> <div attrs="{'invisible': [('dynamic', '=', False)]}">
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
<i <i
class="fa fa-info-circle" class="fa fa-info-circle"
@ -47,7 +47,7 @@
class="fa fa-info-circle" class="fa fa-info-circle"
/> You cannot make manual editions of contacts in fully synchronized lists. /> You cannot make manual editions of contacts in fully synchronized lists.
</div> </div>
</group> </div>
<group colspan="4" attrs="{'invisible': [('dynamic', '=', False)]}"> <group colspan="4" attrs="{'invisible': [('dynamic', '=', False)]}">
<field <field
name="sync_domain" name="sync_domain"