diff --git a/partner_category_security/README.rst b/partner_category_security/README.rst new file mode 100644 index 000000000..130c9e814 --- /dev/null +++ b/partner_category_security/README.rst @@ -0,0 +1,92 @@ +========================= +Partner category security +========================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/14.0/partner_category_security + :alt: OCA/partner-contact +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/partner-contact-14-0/partner-contact-14-0-partner_category_security + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/134/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds a specific security group to manage contact tags (categories). + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +#. *Contact Tags > Publisher* permission allows you to modify the tags assigned to contacts. +#. *Contact Tags > Manager* permission also allows you to manage such tag (create, modify or remove them). +#. *Contacts > Configuration > Contact Tags* menu will only be visible if you "Contact Tags > Manager" permission. +#. *Extra Rights / Contact Creation* and "Internal users" permissions only allows reading the tags assigned to contacts. + +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 +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Víctor Martínez + * Pedro M. Baeza + +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. + +.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px + :target: https://github.com/victoralmau + :alt: victoralmau + +Current `maintainer `__: + +|maintainer-victoralmau| + +This module is part of the `OCA/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_category_security/__init__.py b/partner_category_security/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/partner_category_security/__manifest__.py b/partner_category_security/__manifest__.py new file mode 100644 index 000000000..6b07a08a2 --- /dev/null +++ b/partner_category_security/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2022 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Partner category security", + "version": "14.0.1.0.0", + "category": "Customer Relationship Management", + "website": "https://github.com/OCA/partner-contact", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["contacts"], + "installable": True, + "data": [ + "security/security.xml", + "security/ir.model.access.csv", + "views/menu.xml", + "views/res_partner_view.xml", + ], + "maintainers": ["victoralmau"], +} diff --git a/partner_category_security/i18n/es.po b/partner_category_security/i18n/es.po new file mode 100644 index 000000000..ef2879f2b --- /dev/null +++ b/partner_category_security/i18n/es.po @@ -0,0 +1,33 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_category_security +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-08-25 06:47+0000\n" +"PO-Revision-Date: 2022-08-25 08:48+0200\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"X-Generator: Poedit 3.0.1\n" + +#. module: partner_category_security +#: model:ir.module.category,name:partner_category_security.category_partner_category +msgid "Contact Tags" +msgstr "Etiquetas de contacto" + +#. module: partner_category_security +#: model:res.groups,name:partner_category_security.group_partner_category_manager +msgid "Manager" +msgstr "Responsable" + +#. module: partner_category_security +#: model:res.groups,name:partner_category_security.group_partner_category_user +msgid "Publisher" +msgstr "Editor" diff --git a/partner_category_security/i18n/partner_category_security.pot b/partner_category_security/i18n/partner_category_security.pot new file mode 100644 index 000000000..12ac98ab2 --- /dev/null +++ b/partner_category_security/i18n/partner_category_security.pot @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_category_security +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-08-25 06:47+0000\n" +"PO-Revision-Date: 2022-08-25 06:47+0000\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: partner_category_security +#: model:ir.module.category,name:partner_category_security.category_partner_category +msgid "Contact Tags" +msgstr "" + +#. module: partner_category_security +#: model:res.groups,name:partner_category_security.group_partner_category_manager +msgid "Manager" +msgstr "" + +#. module: partner_category_security +#: model:res.groups,name:partner_category_security.group_partner_category_user +msgid "Publisher" +msgstr "" diff --git a/partner_category_security/readme/CONTRIBUTORS.rst b/partner_category_security/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..5fb713053 --- /dev/null +++ b/partner_category_security/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Víctor Martínez + * Pedro M. Baeza diff --git a/partner_category_security/readme/DESCRIPTION.rst b/partner_category_security/readme/DESCRIPTION.rst new file mode 100644 index 000000000..2cbfb787b --- /dev/null +++ b/partner_category_security/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module adds a specific security group to manage contact tags (categories). diff --git a/partner_category_security/readme/USAGE.rst b/partner_category_security/readme/USAGE.rst new file mode 100644 index 000000000..4600e1340 --- /dev/null +++ b/partner_category_security/readme/USAGE.rst @@ -0,0 +1,4 @@ +#. *Contact Tags > Publisher* permission allows you to modify the tags assigned to contacts. +#. *Contact Tags > Manager* permission also allows you to manage such tag (create, modify or remove them). +#. *Contacts > Configuration > Contact Tags* menu will only be visible if you "Contact Tags > Manager" permission. +#. *Extra Rights / Contact Creation* and "Internal users" permissions only allows reading the tags assigned to contacts. diff --git a/partner_category_security/security/ir.model.access.csv b/partner_category_security/security/ir.model.access.csv new file mode 100644 index 000000000..1ce3fb00e --- /dev/null +++ b/partner_category_security/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_res_partner_category_user,res_partner_category_user,base.model_res_partner_category,group_partner_category_user,1,1,0,0 +access_res_partner_category_manager,res_partner_category_manager,base.model_res_partner_category,group_partner_category_manager,1,1,1,1 +base.access_res_partner_category_group_partner_manager,res_partner_category group_partner_manager,base.model_res_partner_category,base.group_partner_manager,1,0,0,0 diff --git a/partner_category_security/security/security.xml b/partner_category_security/security/security.xml new file mode 100644 index 000000000..e0d7643ac --- /dev/null +++ b/partner_category_security/security/security.xml @@ -0,0 +1,20 @@ + + + + Contact Tags + + + Publisher + + + + + Manager + + + + + diff --git a/partner_category_security/static/description/icon.png b/partner_category_security/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/partner_category_security/static/description/icon.png differ diff --git a/partner_category_security/static/description/index.html b/partner_category_security/static/description/index.html new file mode 100644 index 000000000..ce2d65286 --- /dev/null +++ b/partner_category_security/static/description/index.html @@ -0,0 +1,435 @@ + + + + + + +Partner category security + + + +
+

Partner category security

+ + +

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

+

This module adds a specific security group to manage contact tags (categories).

+

Table of contents

+ +
+

Usage

+
    +
  1. Contact Tags > Publisher permission allows you to modify the tags assigned to contacts.
  2. +
  3. Contact Tags > Manager permission also allows you to manage such tag (create, modify or remove them).
  4. +
  5. Contacts > Configuration > Contact Tags menu will only be visible if you “Contact Tags > Manager” permission.
  6. +
  7. Extra Rights / Contact Creation and “Internal users” permissions only allows reading the tags assigned to contacts.
  8. +
+
+
+

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

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Víctor Martínez
    • +
    • Pedro M. Baeza
    • +
    +
  • +
+
+
+

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.

+

Current maintainer:

+

victoralmau

+

This module is part of the OCA/partner-contact project on GitHub.

+

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

+
+
+
+ + diff --git a/partner_category_security/tests/__init__.py b/partner_category_security/tests/__init__.py new file mode 100644 index 000000000..fd18492a2 --- /dev/null +++ b/partner_category_security/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_partner_category_security diff --git a/partner_category_security/tests/test_partner_category_security.py b/partner_category_security/tests/test_partner_category_security.py new file mode 100644 index 000000000..e301b05fe --- /dev/null +++ b/partner_category_security/tests/test_partner_category_security.py @@ -0,0 +1,46 @@ +# Copyright 2022 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import common, new_test_user + + +class TestPartnerCategorySecurity(common.SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.basic_user = new_test_user( + cls.env, + login="Test basic user", + ) + cls.partner_category_user = new_test_user( + cls.env, + login="Test partner category user", + groups="partner_category_security.group_partner_category_user", + ) + cls.partner_category_manager = new_test_user( + cls.env, + login="Test partner category manager", + groups="partner_category_security.group_partner_category_manager", + ) + cls.partner_category_model = cls.env["res.partner.category"] + + def test_check_access_rights_basic_user(self): + model = self.partner_category_model.with_user(self.basic_user) + self.assertTrue(model.check_access_rights("read", False)) + self.assertFalse(model.check_access_rights("write", False)) + self.assertFalse(model.check_access_rights("create", False)) + self.assertFalse(model.check_access_rights("unlink", False)) + + def test_check_access_rights_partner_category_user(self): + model = self.partner_category_model.with_user(self.partner_category_user) + self.assertTrue(model.check_access_rights("read", False)) + self.assertTrue(model.check_access_rights("write", False)) + self.assertFalse(model.check_access_rights("create", False)) + self.assertFalse(model.check_access_rights("unlink", False)) + + def test_check_access_rights_partner_category_manager(self): + model = self.partner_category_model.with_user(self.partner_category_manager) + self.assertTrue(model.check_access_rights("read", False)) + self.assertTrue(model.check_access_rights("write", False)) + self.assertTrue(model.check_access_rights("create", False)) + self.assertTrue(model.check_access_rights("unlink", False)) diff --git a/partner_category_security/views/menu.xml b/partner_category_security/views/menu.xml new file mode 100644 index 000000000..335f351d9 --- /dev/null +++ b/partner_category_security/views/menu.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/partner_category_security/views/res_partner_view.xml b/partner_category_security/views/res_partner_view.xml new file mode 100644 index 000000000..a90776e43 --- /dev/null +++ b/partner_category_security/views/res_partner_view.xml @@ -0,0 +1,27 @@ + + + res.partner.form + res.partner + + + + + partner_category_security.group_partner_category_user + + + + + + + + diff --git a/setup/partner_category_security/odoo/addons/partner_category_security b/setup/partner_category_security/odoo/addons/partner_category_security new file mode 120000 index 000000000..743f9c5e6 --- /dev/null +++ b/setup/partner_category_security/odoo/addons/partner_category_security @@ -0,0 +1 @@ +../../../../partner_category_security \ No newline at end of file diff --git a/setup/partner_category_security/setup.py b/setup/partner_category_security/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/partner_category_security/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)