Skip to content

Commit

Permalink
[15.0-mig-mass] [MIG] mass_mailing_list_dynamic: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
XanderDeJaegere authored and OCA-git-bot committed Mar 4, 2023
1 parent 64ed252 commit 9fc6ecd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion mass_mailing_list_dynamic/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Dynamic Mass Mailing Lists",
"summary": "Mass mailing lists that get autopopulated",
"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)",
Expand Down
2 changes: 1 addition & 1 deletion mass_mailing_list_dynamic/models/mailing_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def action_sync(self):
Contact.create(vals_list)
one.is_synced = True
# Invalidate cached contact count
self.invalidate_cache(["contact_nbr"], dynamic.ids)
self.invalidate_cache(["contact_count"], dynamic.ids)

@api.onchange("dynamic", "sync_method", "sync_domain")
def _onchange_dynamic(self):
Expand Down
4 changes: 4 additions & 0 deletions mass_mailing_list_dynamic/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
* `Hibou Corp. <https://hibou.io>`_:

* Jared Kipe <jared@hibou.io>

* `Dynapps N.V. <https://www.dynapps.be>`_:

* Xander De Jaegere
17 changes: 8 additions & 9 deletions mass_mailing_list_dynamic/tests/test_dynamic_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
from mock import patch

from odoo.exceptions import ValidationError
from odoo.tests import common
from odoo.tests import common, tagged


class DynamicListCase(common.SavepointCase):
post_install = True

@tagged("post_install", "-at_install")
class DynamicListCase(common.TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down Expand Up @@ -53,12 +52,12 @@ def test_list_sync(self):
{"list_ids": [(4, self.list.id)], "partner_id": self.partners[0].id}
)
self.list.flush()
self.assertEqual(self.list.contact_nbr, 1)
self.assertEqual(self.list.contact_count, 1)
# Set list as add-synced
self.list.dynamic = True
self.list.action_sync()
self.list.flush()
self.assertEqual(self.list.contact_nbr, 4)
self.assertEqual(self.list.contact_count, 4)
self.assertTrue(contact0.exists())
# Set list as full-synced
self.list.sync_method = "full"
Expand All @@ -70,7 +69,7 @@ def test_list_sync(self):
).unlink()
self.list.action_sync()
self.list.flush()
self.assertEqual(self.list.contact_nbr, 3)
self.assertEqual(self.list.contact_count, 3)
self.assertFalse(contact0.exists())
# Cannot add or edit contacts in fully synced lists
with self.assertRaises(ValidationError):
Expand All @@ -95,7 +94,7 @@ def test_sync_when_sending_mail(self):
"""Check that list in synced when sending a mass mailing."""
self.list.action_sync()
self.list.flush()
self.assertEqual(self.list.contact_nbr, 5)
self.assertEqual(self.list.contact_count, 5)
# Create a new partner
self.partners.create(
{
Expand All @@ -109,7 +108,7 @@ def test_sync_when_sending_mail(self):
self.mail.action_send_mail()
self.assertEqual(1, s.call_count)
self.list.flush()
self.assertEqual(6, self.list.contact_nbr)
self.assertEqual(6, self.list.contact_count)

def test_load_filter(self):
domain = "[('id', '=', 1)]"
Expand Down
4 changes: 2 additions & 2 deletions mass_mailing_list_dynamic/views/mailing_list_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
/>
</group>
</xpath>
<field name="contact_nbr" position="attributes">
<field name="contact_count" position="attributes">
<attribute name="attrs">
{'invisible': [('is_synced', '=', False)]}
</attribute>
</field>
<field name="contact_nbr" position="after">
<field name="contact_count" position="after">
<span attrs="{'invisible': [('is_synced', '=', True)]}">
<strong>???</strong>
</span>
Expand Down

0 comments on commit 9fc6ecd

Please sign in to comment.