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",
|
"name": "Dynamic Mass Mailing Lists",
|
||||||
"summary": "Mass mailing lists that get autopopulated",
|
"summary": "Mass mailing lists that get autopopulated",
|
||||||
"version": "14.0.1.0.0",
|
"version": "15.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)",
|
||||||
|
|
|
@ -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_nbr"], dynamic.ids)
|
self.invalidate_cache(["contact_count"], dynamic.ids)
|
||||||
|
|
||||||
@api.onchange("dynamic", "sync_method", "sync_domain")
|
@api.onchange("dynamic", "sync_method", "sync_domain")
|
||||||
def _onchange_dynamic(self):
|
def _onchange_dynamic(self):
|
||||||
|
|
|
@ -9,3 +9,7 @@
|
||||||
* `Hibou Corp. <https://hibou.io>`_:
|
* `Hibou Corp. <https://hibou.io>`_:
|
||||||
|
|
||||||
* Jared Kipe <jared@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 mock import patch
|
||||||
|
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from odoo.tests import common
|
from odoo.tests import common, tagged
|
||||||
|
|
||||||
|
|
||||||
class DynamicListCase(common.SavepointCase):
|
@tagged("post_install", "-at_install")
|
||||||
post_install = True
|
class DynamicListCase(common.TransactionCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super().setUpClass()
|
super().setUpClass()
|
||||||
|
@ -53,12 +52,12 @@ class DynamicListCase(common.SavepointCase):
|
||||||
{"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()
|
||||||
self.assertEqual(self.list.contact_nbr, 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()
|
||||||
self.assertEqual(self.list.contact_nbr, 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
|
||||||
self.list.sync_method = "full"
|
self.list.sync_method = "full"
|
||||||
|
@ -70,7 +69,7 @@ class DynamicListCase(common.SavepointCase):
|
||||||
).unlink()
|
).unlink()
|
||||||
self.list.action_sync()
|
self.list.action_sync()
|
||||||
self.list.flush()
|
self.list.flush()
|
||||||
self.assertEqual(self.list.contact_nbr, 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
|
||||||
with self.assertRaises(ValidationError):
|
with self.assertRaises(ValidationError):
|
||||||
|
@ -95,7 +94,7 @@ class DynamicListCase(common.SavepointCase):
|
||||||
"""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()
|
||||||
self.assertEqual(self.list.contact_nbr, 5)
|
self.assertEqual(self.list.contact_count, 5)
|
||||||
# Create a new partner
|
# Create a new partner
|
||||||
self.partners.create(
|
self.partners.create(
|
||||||
{
|
{
|
||||||
|
@ -109,7 +108,7 @@ class DynamicListCase(common.SavepointCase):
|
||||||
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()
|
||||||
self.assertEqual(6, self.list.contact_nbr)
|
self.assertEqual(6, self.list.contact_count)
|
||||||
|
|
||||||
def test_load_filter(self):
|
def test_load_filter(self):
|
||||||
domain = "[('id', '=', 1)]"
|
domain = "[('id', '=', 1)]"
|
||||||
|
|
|
@ -64,12 +64,12 @@
|
||||||
/>
|
/>
|
||||||
</group>
|
</group>
|
||||||
</xpath>
|
</xpath>
|
||||||
<field name="contact_nbr" position="attributes">
|
<field name="contact_count" position="attributes">
|
||||||
<attribute name="attrs">
|
<attribute name="attrs">
|
||||||
{'invisible': [('is_synced', '=', False)]}
|
{'invisible': [('is_synced', '=', False)]}
|
||||||
</attribute>
|
</attribute>
|
||||||
</field>
|
</field>
|
||||||
<field name="contact_nbr" position="after">
|
<field name="contact_count" position="after">
|
||||||
<span attrs="{'invisible': [('is_synced', '=', True)]}">
|
<span attrs="{'invisible': [('is_synced', '=', True)]}">
|
||||||
<strong>???</strong>
|
<strong>???</strong>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in New Issue