diff --git a/sales_team_security_sale/README.rst b/sales_team_security_sale/README.rst new file mode 100644 index 00000000000..e8aff180afd --- /dev/null +++ b/sales_team_security_sale/README.rst @@ -0,0 +1,111 @@ +=================================== +Sale documents permissions by teams +=================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:47f3a80d25980306a497be31e5cb3e4b1a6dbee9e1ce2f7e67e5f30defc65a72 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |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%2Fsale--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/sale-workflow/tree/17.0/sales_team_security_sale + :alt: OCA/sale-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sales_team_security_sale + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Glue module between sales_team_security and sale. + +This module adds permissions to sales documents according to such a +group as "User: Team Documents Only". + +- Quotations/Sales Orders as implemented in sales_team_security_sale. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +1. Go to *Settings > Users & Companies > Users*. +2. Open or create a user. +3. In the "Sales" section under "Access Rights" tab choose the option + "User: Team Documents Only". + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Tecnativa +* Iván Todorovich + +Contributors +------------ + +- `Tecnativa `__: + + - Pedro M. Baeza + - César A. Sánchez + - Luis D. Lafaurie + +- `Guadaltech `__: + + - Ramón Bajona + +- Iván Todorovich +- `Pesol `__: + + - Jonathan Oscategui Taza + +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-ivantodorovich| image:: https://github.com/ivantodorovich.png?size=40px + :target: https://github.com/ivantodorovich + :alt: ivantodorovich + +Current `maintainer `__: + +|maintainer-ivantodorovich| + +This module is part of the `OCA/sale-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sales_team_security_sale/__init__.py b/sales_team_security_sale/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/sales_team_security_sale/__manifest__.py b/sales_team_security_sale/__manifest__.py new file mode 100644 index 00000000000..7767c88f1aa --- /dev/null +++ b/sales_team_security_sale/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2020 Iván Todorovich +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Sale documents permissions by teams", + "summary": "Integrates sales_team_security with sale", + "version": "17.0.1.0.0", + "category": "Sales", + "website": "https://github.com/OCA/sale-workflow", + "author": "Tecnativa, Iván Todorovich, Odoo Community Association (OCA)", + "license": "AGPL-3", + "development_status": "Production/Stable", + "maintainers": ["ivantodorovich"], + "depends": ["sale", "sales_team_security"], + "data": ["security/security.xml"], + "auto_install": True, +} diff --git a/sales_team_security_sale/i18n/sales_team_security_sale.pot b/sales_team_security_sale/i18n/sales_team_security_sale.pot new file mode 100644 index 00000000000..a11baf5cd77 --- /dev/null +++ b/sales_team_security_sale/i18n/sales_team_security_sale.pot @@ -0,0 +1,13 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.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" diff --git a/sales_team_security_sale/pyproject.toml b/sales_team_security_sale/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/sales_team_security_sale/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sales_team_security_sale/readme/CONFIGURE.md b/sales_team_security_sale/readme/CONFIGURE.md new file mode 100644 index 00000000000..daa36d3965c --- /dev/null +++ b/sales_team_security_sale/readme/CONFIGURE.md @@ -0,0 +1,4 @@ +1. Go to *Settings \> Users & Companies \> Users*. +2. Open or create a user. +3. In the "Sales" section under "Access Rights" tab choose the option + "User: Team Documents Only". diff --git a/sales_team_security_sale/readme/CONTRIBUTORS.md b/sales_team_security_sale/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..5ff3ece456b --- /dev/null +++ b/sales_team_security_sale/readme/CONTRIBUTORS.md @@ -0,0 +1,9 @@ +- [Tecnativa](https://www.tecnativa.com): + - Pedro M. Baeza + - César A. Sánchez + - Luis D. Lafaurie +- [Guadaltech](https://www.guadaltech.es): + - Ramón Bajona +- Iván Todorovich \<\> +- [Pesol](https://www.pesol.es): + - Jonathan Oscategui Taza \<\> diff --git a/sales_team_security_sale/readme/DESCRIPTION.md b/sales_team_security_sale/readme/DESCRIPTION.md new file mode 100644 index 00000000000..36b0a24a8c2 --- /dev/null +++ b/sales_team_security_sale/readme/DESCRIPTION.md @@ -0,0 +1,6 @@ +Glue module between sales_team_security and sale. + +This module adds permissions to sales documents according to such a +group as "User: Team Documents Only". + +- Quotations/Sales Orders as implemented in sales_team_security_sale. diff --git a/sales_team_security_sale/security/security.xml b/sales_team_security_sale/security/security.xml new file mode 100644 index 00000000000..1cbb2c39fcb --- /dev/null +++ b/sales_team_security_sale/security/security.xml @@ -0,0 +1,38 @@ + + + + Team Orders + + ['|', ('user_id', 'in', [user.id, False]), ('team_id', 'in', user.crm_team_ids.ids + [False])] + + + + + Team Orders Analysis + + ['|', ('user_id', 'in', [user.id, False]), ('team_id', 'in', user.crm_team_ids.ids + [False])] + + + + Team Order Lines + + ['|', ('salesman_id', 'in', [user.id, False]), ('order_id.team_id', 'in', user.crm_team_ids.ids + [False])] + + + + diff --git a/sales_team_security_sale/static/description/icon.png b/sales_team_security_sale/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/sales_team_security_sale/static/description/icon.png differ diff --git a/sales_team_security_sale/static/description/index.html b/sales_team_security_sale/static/description/index.html new file mode 100644 index 00000000000..5e91c99a05a --- /dev/null +++ b/sales_team_security_sale/static/description/index.html @@ -0,0 +1,455 @@ + + + + + +Sale documents permissions by teams + + + +
+

Sale documents permissions by teams

+ + +

Production/Stable License: AGPL-3 OCA/sale-workflow Translate me on Weblate Try me on Runboat

+

Glue module between sales_team_security and sale.

+

This module adds permissions to sales documents according to such a +group as “User: Team Documents Only”.

+
    +
  • Quotations/Sales Orders as implemented in sales_team_security_sale.
  • +
+

Table of contents

+ +
+

Configuration

+
    +
  1. Go to Settings > Users & Companies > Users.
  2. +
  3. Open or create a user.
  4. +
  5. In the “Sales” section under “Access Rights” tab choose the option +“User: Team Documents Only”.
  6. +
+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
  • Iván Todorovich
  • +
+
+
+

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.

+

Current maintainer:

+

ivantodorovich

+

This module is part of the OCA/sale-workflow project on GitHub.

+

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

+
+
+
+ + diff --git a/sales_team_security_sale/tests/__init__.py b/sales_team_security_sale/tests/__init__.py new file mode 100644 index 00000000000..6d15aea0463 --- /dev/null +++ b/sales_team_security_sale/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_sales_team_security_sale diff --git a/sales_team_security_sale/tests/test_sales_team_security_sale.py b/sales_team_security_sale/tests/test_sales_team_security_sale.py new file mode 100644 index 00000000000..1af233b1907 --- /dev/null +++ b/sales_team_security_sale/tests/test_sales_team_security_sale.py @@ -0,0 +1,28 @@ +# Copyright 2021 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.addons.sales_team_security.tests.common import TestCommon + + +class TestSalesTeamSecuritySale(TestCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env["ir.config_parameter"].set_param("sales_team.membership_multi", True) + cls.team3 = cls.env["crm.team"].create({"name": "Test channel 3"}) + cls.env["crm.team.member"].create( + {"user_id": cls.user.id, "crm_team_id": cls.team3.id} + ) + cls.record = cls.env["sale.order"].create( + { + "partner_id": cls.partner.id, + "user_id": cls.user.id, + "team_id": cls.team.id, + } + ) + + def test_sale_order_permissions(self): + self._check_whole_permission_set(extra_checks=False) + + def test_sale_order_permissions_multi_team(self): + self._check_permission(False, self.team3, True)