diff --git a/README.md b/README.md index 4b8e5e6017..ac2391b1ff 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ addon | version | maintainers | summary [pos_sale_picking_keep](pos_sale_picking_keep/) | 18.0.1.0.1 | pedrobaeza | Keep sale pickings from PoS [pos_session_pay_invoice](pos_session_pay_invoice/) | 18.0.1.0.0 | | Pay and receive invoices from PoS Session [pos_supplierinfo_search](pos_supplierinfo_search/) | 18.0.1.0.0 | eLBati | Search products by supplier data +[pos_user_restrict_provider_info](pos_user_restrict_provider_info/) | 18.0.1.0.0 | BernatObrador | Restrict provider info to pos users [pos_user_restriction](pos_user_restriction/) | 18.0.1.0.0 | eLBati | Restrict some users to see and use only certain points of sale [//]: # (end addons) diff --git a/pos_blind_session_closing/i18n/it.po b/pos_blind_session_closing/i18n/it.po new file mode 100644 index 0000000000..f82d2afa77 --- /dev/null +++ b/pos_blind_session_closing/i18n/it.po @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_blind_session_closing +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-04-08 12:45+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.15.2\n" + +#. module: pos_blind_session_closing +#: model:res.groups,name:pos_blind_session_closing.group_pos_close_session_amounts +msgid "Can see POS closing amounts" +msgstr "Può vedere i valori di chiusura del POS" diff --git a/pos_user_restrict_provider_info/README.rst b/pos_user_restrict_provider_info/README.rst new file mode 100644 index 0000000000..b2e61c0510 --- /dev/null +++ b/pos_user_restrict_provider_info/README.rst @@ -0,0 +1,91 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +============================ +POS - Restrict Provider Info +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:161a43ebedc3bd1b1e56079f7d1a25abb2800f3bd94512217dbb1618cb424729 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/18.0/pos_user_restrict_provider_info + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-18-0/pos-18-0-pos_user_restrict_provider_info + :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/pos&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module controls access to supplier information in the Point of Sale +product details, restricting visibility for pos users. + +**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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ASPL-Nagarro + +Contributors +------------ + +- `APSL-Nagarro `__: + + - Bernat Obrador + +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-BernatObrador| image:: https://github.com/BernatObrador.png?size=40px + :target: https://github.com/BernatObrador + :alt: BernatObrador + +Current `maintainer `__: + +|maintainer-BernatObrador| + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_user_restrict_provider_info/__init__.py b/pos_user_restrict_provider_info/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pos_user_restrict_provider_info/__manifest__.py b/pos_user_restrict_provider_info/__manifest__.py new file mode 100644 index 0000000000..49fa508ff7 --- /dev/null +++ b/pos_user_restrict_provider_info/__manifest__.py @@ -0,0 +1,19 @@ +{ + "name": "POS - Restrict Provider Info", + "version": "18.0.1.0.0", + "summary": "Restrict provider info to pos users", + "category": "Point of Sale", + "author": "ASPL-Nagarro, Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/pos", + "maintainers": ["BernatObrador"], + "depends": ["point_of_sale"], + "assets": { + "point_of_sale._assets_pos": [ + "pos_user_restrict_provider_info/static/src/**/*", + ], + "web.assets_tests": [ + "pos_user_restrict_provider_info/static/tests/tours/**/*", + ], + }, +} diff --git a/pos_user_restrict_provider_info/i18n/pos_user_restrict_provider_info.pot b/pos_user_restrict_provider_info/i18n/pos_user_restrict_provider_info.pot new file mode 100644 index 0000000000..aadee09bfe --- /dev/null +++ b/pos_user_restrict_provider_info/i18n/pos_user_restrict_provider_info.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 18.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/pos_user_restrict_provider_info/pyproject.toml b/pos_user_restrict_provider_info/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/pos_user_restrict_provider_info/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/pos_user_restrict_provider_info/readme/CONTRIBUTORS.md b/pos_user_restrict_provider_info/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..fafb6bf1b0 --- /dev/null +++ b/pos_user_restrict_provider_info/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [APSL-Nagarro](): + - Bernat Obrador \<\> + \ No newline at end of file diff --git a/pos_user_restrict_provider_info/readme/DESCRIPTION.md b/pos_user_restrict_provider_info/readme/DESCRIPTION.md new file mode 100644 index 0000000000..a3f133f07f --- /dev/null +++ b/pos_user_restrict_provider_info/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module controls access to supplier information in the Point of Sale product details, restricting visibility for pos users. \ No newline at end of file diff --git a/pos_user_restrict_provider_info/static/description/icon.png b/pos_user_restrict_provider_info/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_user_restrict_provider_info/static/description/icon.png differ diff --git a/pos_user_restrict_provider_info/static/description/index.html b/pos_user_restrict_provider_info/static/description/index.html new file mode 100644 index 0000000000..c9a62b8917 --- /dev/null +++ b/pos_user_restrict_provider_info/static/description/index.html @@ -0,0 +1,435 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

POS - Restrict Provider Info

+ +

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

+

This module controls access to supplier information in the Point of Sale +product details, restricting visibility for pos users.

+

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

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ASPL-Nagarro
  • +
+
+
+

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:

+

BernatObrador

+

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

+

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

+
+
+
+
+ + diff --git a/pos_user_restrict_provider_info/static/src/js/pos_store.esm.js b/pos_user_restrict_provider_info/static/src/js/pos_store.esm.js new file mode 100644 index 0000000000..3a983e6903 --- /dev/null +++ b/pos_user_restrict_provider_info/static/src/js/pos_store.esm.js @@ -0,0 +1,16 @@ +/** + * Copyright 2026 Bernat Obrador APSL-Nagarro + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + */ +import {PosStore} from "@point_of_sale/app/store/pos_store"; +import {patch} from "@web/core/utils/patch"; +import {user} from "@web/core/user"; + +patch(PosStore.prototype, { + async setup() { + await super.setup(...arguments); + this.user.canSeeSupplierInfo = await user.hasGroup( + "point_of_sale.group_pos_manager" + ); + }, +}); diff --git a/pos_user_restrict_provider_info/static/src/xml/product_info_popup.xml b/pos_user_restrict_provider_info/static/src/xml/product_info_popup.xml new file mode 100644 index 0000000000..4b7ca2a379 --- /dev/null +++ b/pos_user_restrict_provider_info/static/src/xml/product_info_popup.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/pos_user_restrict_provider_info/static/tests/tours/pos_user_restrict_provider_info_tour.esm.js b/pos_user_restrict_provider_info/static/tests/tours/pos_user_restrict_provider_info_tour.esm.js new file mode 100644 index 0000000000..05f77b04bf --- /dev/null +++ b/pos_user_restrict_provider_info/static/tests/tours/pos_user_restrict_provider_info_tour.esm.js @@ -0,0 +1,61 @@ +/* global document */ +import * as Chrome from "@point_of_sale/../tests/tours/utils/chrome_util"; +import * as Dialog from "@point_of_sale/../tests/tours/utils/dialog_util"; +import * as ProductScreen from "@point_of_sale/../tests/tours/utils/product_screen_util"; + +import {inLeftSide} from "@point_of_sale/../tests/tours/utils/common"; +import {registry} from "@web/core/registry"; + +const INFO_BUTTON = ".product-information-tag"; +const MODAL_BODY = "main.modal-body"; +const SUPPLIER_SECTION = `${MODAL_BODY} .section-supplier`; +const CLOSE_BUTTON = ".modal .btn-close, .modal .close, button.btn-close, button.close"; + +function openProductInfoPopup(productName) { + return [ + ProductScreen.clickDisplayedProduct(productName, true), + inLeftSide([ + { + trigger: INFO_BUTTON, + run: "click", + }, + ]), + { + trigger: MODAL_BODY, + }, + ]; +} + +registry.category("web_tour.tours").add("pos_supplier_info_visible_for_manager", { + steps: () => + [ + Chrome.startPoS(), + Dialog.confirm("Open Register"), + ...openProductInfoPopup("Desk Organizer"), + {trigger: SUPPLIER_SECTION}, + {trigger: CLOSE_BUTTON, run: "click"}, + ].flat(), +}); + +registry.category("web_tour.tours").add("pos_supplier_info_hidden_for_non_manager", { + steps: () => + [ + Chrome.startPoS(), + Dialog.confirm("Open Register"), + + ...openProductInfoPopup("Desk Organizer"), + { + trigger: MODAL_BODY, + run: function () { + const root = document.querySelector("main.modal-body"); + const el = root && root.querySelector(".section-supplier"); + if (el) { + throw new Error( + "Supplier section should be hidden for non POS managers." + ); + } + }, + }, + {trigger: CLOSE_BUTTON, run: "click"}, + ].flat(), +}); diff --git a/pos_user_restrict_provider_info/tests/__init__.py b/pos_user_restrict_provider_info/tests/__init__.py new file mode 100644 index 0000000000..861ae959cc --- /dev/null +++ b/pos_user_restrict_provider_info/tests/__init__.py @@ -0,0 +1 @@ +from . import test_pos_supplier_info_visibility diff --git a/pos_user_restrict_provider_info/tests/test_pos_supplier_info_visibility.py b/pos_user_restrict_provider_info/tests/test_pos_supplier_info_visibility.py new file mode 100644 index 0000000000..610c9ca0d9 --- /dev/null +++ b/pos_user_restrict_provider_info/tests/test_pos_supplier_info_visibility.py @@ -0,0 +1,42 @@ +from odoo.tests import tagged + +from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon + + +@tagged("post_install", "-at_install") +class TestPosSupplierInfoVisibility(TestPointOfSaleHttpCommon): + def _create_user(self, login, groups): + return ( + self.env["res.users"] + .with_context(no_reset_password=True) + .create( + { + "name": login, + "login": login, + "email": f"{login}@example.com", + "groups_id": [(6, 0, groups)], + } + ) + ) + + def test_supplier_section_hidden_for_non_manager(self): + base_user = self.env.ref("base.group_user").id + pos_user_group = self.env.ref("point_of_sale.group_pos_user").id + user = self._create_user("pos_cashier_test", [base_user, pos_user_group]) + + self.start_tour( + "/pos/ui?config_id=%d" % self.main_pos_config.id, + "pos_supplier_info_hidden_for_non_manager", + login=user.login, + ) + + def test_supplier_section_visible_for_manager(self): + base_user = self.env.ref("base.group_user").id + pos_manager = self.env.ref("point_of_sale.group_pos_manager").id + user = self._create_user("pos_manager_test", [base_user, pos_manager]) + + self.start_tour( + "/pos/ui?config_id=%d" % self.main_pos_config.id, + "pos_supplier_info_visible_for_manager", + login=user.login, + ) diff --git a/setup/_metapackage/pyproject.toml b/setup/_metapackage/pyproject.toml index cb1888f8b3..1ddcc45ceb 100644 --- a/setup/_metapackage/pyproject.toml +++ b/setup/_metapackage/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "odoo-addons-oca-pos" -version = "18.0.20260407.1" +version = "18.0.20260408.0" dependencies = [ "odoo-addon-pos_barcode_rule_priced_with_change_rate==18.0.*", "odoo-addon-pos_blind_session_closing==18.0.*", @@ -19,6 +19,7 @@ dependencies = [ "odoo-addon-pos_sale_picking_keep==18.0.*", "odoo-addon-pos_session_pay_invoice==18.0.*", "odoo-addon-pos_supplierinfo_search==18.0.*", + "odoo-addon-pos_user_restrict_provider_info==18.0.*", "odoo-addon-pos_user_restriction==18.0.*", ] classifiers=[