diff --git a/mass_mailing_contact_active/README.rst b/mass_mailing_contact_active/README.rst new file mode 100644 index 000000000..5f75adc4c --- /dev/null +++ b/mass_mailing_contact_active/README.rst @@ -0,0 +1,81 @@ +=========================== +Mass Mailing Contact Active +=========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/16.0/mass_mailing_contact_active + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mass_mailing_contact_active + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/social&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds an active field on mailing contact and subscription. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +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 +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Akim Juillerat +* `Trobz `_: + + * Nguyễn Minh Chiến + +Other credits +~~~~~~~~~~~~~ + +The migration of this module from 13.0 to 16.0 was financially supported by Camptocamp + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mass_mailing_contact_active/__init__.py b/mass_mailing_contact_active/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/mass_mailing_contact_active/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mass_mailing_contact_active/__manifest__.py b/mass_mailing_contact_active/__manifest__.py new file mode 100644 index 000000000..1ff236705 --- /dev/null +++ b/mass_mailing_contact_active/__manifest__.py @@ -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": "16.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"], +} diff --git a/mass_mailing_contact_active/i18n/mass_mailing_contact_active.pot b/mass_mailing_contact_active/i18n/mass_mailing_contact_active.pot new file mode 100644 index 000000000..56cce5db9 --- /dev/null +++ b/mass_mailing_contact_active/i18n/mass_mailing_contact_active.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_contact_active +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mass_mailing_contact_active +#: model:ir.model.fields,field_description:mass_mailing_contact_active.field_mailing_contact__active +#: model:ir.model.fields,field_description:mass_mailing_contact_active.field_mailing_contact_subscription__active +msgid "Active" +msgstr "" + +#. module: mass_mailing_contact_active +#: model:ir.model,name:mass_mailing_contact_active.model_mailing_contact +msgid "Mailing Contact" +msgstr "" + +#. module: mass_mailing_contact_active +#: model:ir.model,name:mass_mailing_contact_active.model_mailing_contact_subscription +msgid "Mass Mailing Subscription Information" +msgstr "" diff --git a/mass_mailing_contact_active/models/__init__.py b/mass_mailing_contact_active/models/__init__.py new file mode 100644 index 000000000..492201e70 --- /dev/null +++ b/mass_mailing_contact_active/models/__init__.py @@ -0,0 +1,2 @@ +from . import mailing_contact +from . import mailing_contact_subscription diff --git a/mass_mailing_contact_active/models/mailing_contact.py b/mass_mailing_contact_active/models/mailing_contact.py new file mode 100644 index 000000000..0271bf360 --- /dev/null +++ b/mass_mailing_contact_active/models/mailing_contact.py @@ -0,0 +1,21 @@ +# 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: + # Have to search to fetch the inactive records + subscriptions = self.env["mailing.contact.subscription"].search( + [("contact_id", "in", self.ids), ("active", "!=", values["active"])] + ) + if subscriptions: + subscriptions.write({"active": values["active"]}) + return res diff --git a/mass_mailing_contact_active/models/mailing_contact_subscription.py b/mass_mailing_contact_active/models/mailing_contact_subscription.py new file mode 100644 index 000000000..5ecce5837 --- /dev/null +++ b/mass_mailing_contact_active/models/mailing_contact_subscription.py @@ -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) diff --git a/mass_mailing_contact_active/readme/CONTRIBUTORS.rst b/mass_mailing_contact_active/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..6797e38c8 --- /dev/null +++ b/mass_mailing_contact_active/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Akim Juillerat +* `Trobz `_: + + * Nguyễn Minh Chiến diff --git a/mass_mailing_contact_active/readme/CREDITS.rst b/mass_mailing_contact_active/readme/CREDITS.rst new file mode 100644 index 000000000..d43b3aa65 --- /dev/null +++ b/mass_mailing_contact_active/readme/CREDITS.rst @@ -0,0 +1 @@ +The migration of this module from 13.0 to 16.0 was financially supported by Camptocamp diff --git a/mass_mailing_contact_active/readme/DESCRIPTION.rst b/mass_mailing_contact_active/readme/DESCRIPTION.rst new file mode 100644 index 000000000..f54eb74ca --- /dev/null +++ b/mass_mailing_contact_active/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module adds an active field on mailing contact and subscription. diff --git a/mass_mailing_contact_active/static/description/icon.png b/mass_mailing_contact_active/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/mass_mailing_contact_active/static/description/icon.png differ diff --git a/mass_mailing_contact_active/static/description/index.html b/mass_mailing_contact_active/static/description/index.html new file mode 100644 index 000000000..1ae2112ba --- /dev/null +++ b/mass_mailing_contact_active/static/description/index.html @@ -0,0 +1,432 @@ + + + + + + +Mass Mailing Contact Active + + + +
+

Mass Mailing Contact Active

+ + +

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

+

This module adds an active field on mailing contact and subscription.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +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 +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The migration of this module from 13.0 to 16.0 was financially supported by Camptocamp

+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/social project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/mass_mailing_contact_active/tests/__init__.py b/mass_mailing_contact_active/tests/__init__.py new file mode 100644 index 000000000..e7b86f146 --- /dev/null +++ b/mass_mailing_contact_active/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mailing_contact_active diff --git a/mass_mailing_contact_active/tests/test_mailing_contact_active.py b/mass_mailing_contact_active/tests/test_mailing_contact_active.py new file mode 100644 index 000000000..d032b56fb --- /dev/null +++ b/mass_mailing_contact_active/tests/test_mailing_contact_active.py @@ -0,0 +1,22 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo.tests.common import TransactionCase + + +class TestMailingContactActive(TransactionCase): + @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) + self.mailing_contact.write({"active": True}) + self.assertTrue(self.mailing_contact.active) + self.assertTrue(subscription.active) diff --git a/setup/mass_mailing_contact_active/odoo/addons/mass_mailing_contact_active b/setup/mass_mailing_contact_active/odoo/addons/mass_mailing_contact_active new file mode 120000 index 000000000..c793287ec --- /dev/null +++ b/setup/mass_mailing_contact_active/odoo/addons/mass_mailing_contact_active @@ -0,0 +1 @@ +../../../../mass_mailing_contact_active \ No newline at end of file diff --git a/setup/mass_mailing_contact_active/setup.py b/setup/mass_mailing_contact_active/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mass_mailing_contact_active/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)