mirror of https://github.com/OCA/social.git
[15.0-mig-mass] [MIG] mass_mailing_list_dynamic: Migration to 15.0
parent
64ed252cf5
commit
9fc6ecd447
|
@ -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)",
|
||||
|
|
|
@ -65,7 +65,7 @@ class MassMailingList(models.Model):
|
|||
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):
|
||||
|
|
|
@ -9,3 +9,7 @@
|
|||
* `Hibou Corp. <https://hibou.io>`_:
|
||||
|
||||
* Jared Kipe <jared@hibou.io>
|
||||
|
||||
* `Dynapps N.V. <https://www.dynapps.be>`_:
|
||||
|
||||
* Xander De Jaegere
|
||||
|
|
|
@ -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()
|
||||
|
@ -53,12 +52,12 @@ class DynamicListCase(common.SavepointCase):
|
|||
{"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"
|
||||
|
@ -70,7 +69,7 @@ class DynamicListCase(common.SavepointCase):
|
|||
).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):
|
||||
|
@ -95,7 +94,7 @@ class DynamicListCase(common.SavepointCase):
|
|||
"""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(
|
||||
{
|
||||
|
@ -109,7 +108,7 @@ class DynamicListCase(common.SavepointCase):
|
|||
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)]"
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue