mirror of https://github.com/OCA/social.git
Create module mass_mailing_contact_active
parent
c05f81f2c7
commit
75da1fed11
|
@ -0,0 +1 @@
|
||||||
|
from . import models
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Copyright 2022 Camptocamp SA
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||||
|
{
|
||||||
|
"name": "Mass Mailing Contact Active",
|
||||||
|
"summary": "Adds active feature on mailing list contact and subscriptions",
|
||||||
|
"version": "13.0.1.0.0",
|
||||||
|
"category": "Marketing/Email Marketing",
|
||||||
|
"website": "https://github.com/OCA/social",
|
||||||
|
"author": "Camptocamp, Odoo Community Association (OCA)",
|
||||||
|
"license": "AGPL-3",
|
||||||
|
"application": False,
|
||||||
|
"installable": True,
|
||||||
|
"depends": ["mass_mailing"],
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
from . import mailing_contact
|
||||||
|
from . import mailing_contact_subscription
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Copyright 2022 Camptocamp SA
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class MailingContact(models.Model):
|
||||||
|
|
||||||
|
_inherit = "mailing.contact"
|
||||||
|
|
||||||
|
active = fields.Boolean(default=True)
|
||||||
|
|
||||||
|
def write(self, values):
|
||||||
|
res = super().write(values)
|
||||||
|
if "active" in values:
|
||||||
|
self.mapped("subscription_list_ids").write({"active": values["active"]})
|
||||||
|
return res
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Copyright 2022 Camptocamp SA
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class MailingContactSubscription(models.Model):
|
||||||
|
|
||||||
|
_inherit = "mailing.contact.subscription"
|
||||||
|
|
||||||
|
active = fields.Boolean(default=True)
|
|
@ -0,0 +1 @@
|
||||||
|
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
|
@ -0,0 +1 @@
|
||||||
|
This module adds an active field on mailing contact and subscription.
|
|
@ -0,0 +1 @@
|
||||||
|
from . import test_mailing_contact_active
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Copyright 2022 Camptocamp SA
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||||
|
from odoo.tests.common import SavepointCase
|
||||||
|
|
||||||
|
|
||||||
|
class TestMailingContactActive(SavepointCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
|
cls.mailing_contact = cls.env.ref("mass_mailing.mass_mail_contact_1")
|
||||||
|
|
||||||
|
def test_archive_unarchive_mailing_contact(self):
|
||||||
|
self.assertTrue(self.mailing_contact.active)
|
||||||
|
subscription = self.mailing_contact.subscription_list_ids
|
||||||
|
self.assertTrue(subscription)
|
||||||
|
self.assertTrue(subscription.active)
|
||||||
|
self.mailing_contact.write({"active": False})
|
||||||
|
self.assertFalse(self.mailing_contact.active)
|
||||||
|
self.assertFalse(subscription.active)
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../mass_mailing_contact_active
|
|
@ -0,0 +1,6 @@
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
Loading…
Reference in New Issue