diff --git a/mail_restrict_follower_selection/README.rst b/mail_restrict_follower_selection/README.rst index fb0656d..e09b186 100644 --- a/mail_restrict_follower_selection/README.rst +++ b/mail_restrict_follower_selection/README.rst @@ -1,63 +1,97 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 - =========================== Restrict follower selection =========================== -This module was written to allow you to restrict the selection of possible followers. For example, if you use the social ERP functions only internally, it makes sense to filter possible followers for being employees. Otherwise, you'll get a quite crowded list of partners to choose from. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -Moreover, the module disables the option to automatically add followers that do not meet the domain. +.. |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/13.0/mail_restrict_follower_selection + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-13-0/social-13-0-mail_restrict_follower_selection + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/205/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module was written to allow you to restrict the selection of possible +followers. For example, if you use the social ERP functions only internally, +it makes sense to filter possible followers for being employees. Otherwise, +you'll get a quite crowded list of partners to choose from. + +Moreover, the module disables the option to automatically add followers that +do not meet the domain. + +**Table of contents** + +.. contents:: + :local: Configuration ============= -To configure this module, you need to go to `System parameters` and adjust `mail_restrict_follower_selection.domain` as you see fit. This restricts followers globally, if you want to restrict only the followers for a certain record type (or have different restrictions for different record types), create a parameter `mail_restrict_follower_selection.domain.$your_model`. +To configure this module, you need to go to `System parameters` and adjust +`mail_restrict_follower_selection.domain` as you see fit. This restricts +followers globally, if you want to restrict only the followers for a certain +record type (or have different restrictions for different record types), +create a parameter `mail_restrict_follower_selection.domain.$your_model`. -As an example, you could use `[('customer', '=', True)]` to allow only customers to be added as follower - this also is the default. +As an example, you could use `[('category_id.name', '=', 'Employees')]` to allow +only contacts with 'Employees' tag to be added as follower - this also is +the default. Note: This module won't change existing followers! -Usage -===== - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/205/11.0 - -For further information, please visit: - -* https://www.odoo.com/forum/help-1 - 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 -`here `_. +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 +~~~~~~~ + +* Therp BV +* Creu Blanca + Contributors ------------- +~~~~~~~~~~~~ * Holger Brunn * Nguyen Tan Phuc * Enric Tobella -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit http://odoo-community.org. +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/mail_restrict_follower_selection/__manifest__.py b/mail_restrict_follower_selection/__manifest__.py index a207322..3911502 100644 --- a/mail_restrict_follower_selection/__manifest__.py +++ b/mail_restrict_follower_selection/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Restrict follower selection", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "author": "Therp BV,Creu Blanca,Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Social Network", diff --git a/mail_restrict_follower_selection/data/ir_config_parameter.xml b/mail_restrict_follower_selection/data/ir_config_parameter.xml index f4a1daf..3602566 100644 --- a/mail_restrict_follower_selection/data/ir_config_parameter.xml +++ b/mail_restrict_follower_selection/data/ir_config_parameter.xml @@ -2,6 +2,6 @@ mail_restrict_follower_selection.domain - [('customer', '=', True)] + [('category_id.name', '=', 'Employees')] diff --git a/mail_restrict_follower_selection/i18n/mail_restrict_follower_selection.pot b/mail_restrict_follower_selection/i18n/mail_restrict_follower_selection.pot index 8a87100..5356952 100644 --- a/mail_restrict_follower_selection/i18n/mail_restrict_follower_selection.pot +++ b/mail_restrict_follower_selection/i18n/mail_restrict_follower_selection.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * mail_restrict_follower_selection +# * mail_restrict_follower_selection # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -32,4 +32,3 @@ msgstr "" #: model:ir.model,name:mail_restrict_follower_selection.model_mail_wizard_invite msgid "Invite wizard" msgstr "" - diff --git a/mail_restrict_follower_selection/models/mail_thread.py b/mail_restrict_follower_selection/models/mail_thread.py index 0bacf17..0193079 100644 --- a/mail_restrict_follower_selection/models/mail_thread.py +++ b/mail_restrict_follower_selection/models/mail_thread.py @@ -1,11 +1,10 @@ -from odoo import api, models +from odoo import models from odoo.tools.safe_eval import safe_eval class MailThread(models.AbstractModel): _inherit = "mail.thread" - @api.multi def _message_add_suggested_recipient( self, result, partner=None, email=None, reason="" ): diff --git a/mail_restrict_follower_selection/readme/CONFIGURE.rst b/mail_restrict_follower_selection/readme/CONFIGURE.rst new file mode 100644 index 0000000..9c23308 --- /dev/null +++ b/mail_restrict_follower_selection/readme/CONFIGURE.rst @@ -0,0 +1,11 @@ +To configure this module, you need to go to `System parameters` and adjust +`mail_restrict_follower_selection.domain` as you see fit. This restricts +followers globally, if you want to restrict only the followers for a certain +record type (or have different restrictions for different record types), +create a parameter `mail_restrict_follower_selection.domain.$your_model`. + +As an example, you could use `[('category_id.name', '=', 'Employees')]` to allow +only contacts with 'Employees' tag to be added as follower - this also is +the default. + +Note: This module won't change existing followers! diff --git a/mail_restrict_follower_selection/readme/CONTRIBUTORS.rst b/mail_restrict_follower_selection/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..47b2b8d --- /dev/null +++ b/mail_restrict_follower_selection/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Holger Brunn +* Nguyen Tan Phuc +* Enric Tobella diff --git a/mail_restrict_follower_selection/readme/DESCRIPTION.rst b/mail_restrict_follower_selection/readme/DESCRIPTION.rst new file mode 100644 index 0000000..d8867e5 --- /dev/null +++ b/mail_restrict_follower_selection/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +This module was written to allow you to restrict the selection of possible +followers. For example, if you use the social ERP functions only internally, +it makes sense to filter possible followers for being employees. Otherwise, +you'll get a quite crowded list of partners to choose from. + +Moreover, the module disables the option to automatically add followers that +do not meet the domain. diff --git a/mail_restrict_follower_selection/static/description/index.html b/mail_restrict_follower_selection/static/description/index.html new file mode 100644 index 0000000..49f0727 --- /dev/null +++ b/mail_restrict_follower_selection/static/description/index.html @@ -0,0 +1,440 @@ + + + + + + +Restrict follower selection + + + +
+

Restrict follower selection

+ + +

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

+

This module was written to allow you to restrict the selection of possible +followers. For example, if you use the social ERP functions only internally, +it makes sense to filter possible followers for being employees. Otherwise, +you’ll get a quite crowded list of partners to choose from.

+

Moreover, the module disables the option to automatically add followers that +do not meet the domain.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to go to System parameters and adjust +mail_restrict_follower_selection.domain as you see fit. This restricts +followers globally, if you want to restrict only the followers for a certain +record type (or have different restrictions for different record types), +create a parameter mail_restrict_follower_selection.domain.$your_model.

+

As an example, you could use [(‘category_id.name’, ‘=’, ‘Employees’)] to allow +only contacts with ‘Employees’ tag to be added as follower - this also is +the default.

+

Note: This module won’t change existing followers!

+
+
+

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

+
    +
  • Therp BV
  • +
  • Creu Blanca
  • +
+
+
+

Contributors

+ +
+
+

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/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py b/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py index 0b78d65..c4ce705 100644 --- a/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py +++ b/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py @@ -10,8 +10,16 @@ from odoo.tests.common import TransactionCase class TestMailRestrictFollowerSelection(TransactionCase): def setUp(self): super().setUp() + self.category_employees = self.env["res.partner.category"].create( + {"name": "Employees"} + ) + self.partner = self.env["res.partner"].create( - {"name": "Partner", "customer": True, "email": "test@test.com"} + { + "name": "Partner", + "category_id": self.category_employees, + "email": "test@test.com", + } ) def test_fields_view_get(self): @@ -45,16 +53,14 @@ class TestMailRestrictFollowerSelection(TransactionCase): compose.action_send_mail() def test_followers_meet(self): - self.partner.write({"customer": True}) - self.assertTrue(self.partner.customer) + self.partner.write({"category_id": self.category_employees}) self.send_action() self.assertIn( self.partner, self.partner.message_follower_ids.mapped("partner_id") ) def test_followers_not_meet(self): - self.partner.write({"customer": False}) - self.assertFalse(self.partner.customer) + self.partner.write({"category_id": False}) self.send_action() self.assertNotIn( self.partner, self.partner.message_follower_ids.mapped("partner_id")