diff --git a/setup/stock_location_report_manager_layout/odoo/addons/stock_location_report_manager_layout b/setup/stock_location_report_manager_layout/odoo/addons/stock_location_report_manager_layout new file mode 120000 index 00000000..8f963d41 --- /dev/null +++ b/setup/stock_location_report_manager_layout/odoo/addons/stock_location_report_manager_layout @@ -0,0 +1 @@ +../../../../stock_location_report_manager_layout \ No newline at end of file diff --git a/setup/stock_location_report_manager_layout/setup.py b/setup/stock_location_report_manager_layout/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/stock_location_report_manager_layout/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_location_report_manager_layout/README.rst b/stock_location_report_manager_layout/README.rst new file mode 100644 index 00000000..7a9f39dd --- /dev/null +++ b/stock_location_report_manager_layout/README.rst @@ -0,0 +1,100 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +==================================== +Stock Location Report Manager Layout +==================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:3c519dae8c0bb3c90bc5f11d688db658db73f033007036878bd5ff768a4200a0 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-qrtl%2Faxls--custom-lightgray.png?logo=github + :target: https://github.com/qrtl/axls-custom/tree/16.0/stock_location_report_manager_layout + :alt: qrtl/axls-custom + +|badge1| |badge2| |badge3| + +This module changes the Locations report (*Inventory > Reporting > +Locations*) so that non-managers see a read-only copy of the manager +layout. + +Depending on the user's groups, the Locations report list view resolves +to: + +- Stock managers: the existing editable manager layout (unchanged). +- All other users: a read-only copy of the manager layout, so they see + the richer manager column set (and its extension columns, such as + expiration date) without being able to create, edit or delete + records. + +A module such as ``stock_reporting_access`` should be installed to let +non-manager users access the *Inventory > Reporting* menu item. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +1. Log in as a stock user who is not a stock manager. +2. Go to *Inventory > Reporting > Locations*. +3. The list shows the manager layout columns, but records cannot be + created, edited or deleted. + +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 +------- + +* Quartile + +Contributors +------------ + +- `Quartile `__: + + - Toshikimi Shigenobu + - Aung Ko Ko Lin + +Maintainers +----------- + +.. |maintainer-nobuQuartile| image:: https://github.com/nobuQuartile.png?size=40px + :target: https://github.com/nobuQuartile + :alt: nobuQuartile +.. |maintainer-AungKoKoLin1997| image:: https://github.com/AungKoKoLin1997.png?size=40px + :target: https://github.com/AungKoKoLin1997 + :alt: AungKoKoLin1997 + +Current maintainers: + +|maintainer-nobuQuartile| |maintainer-AungKoKoLin1997| + +This module is part of the `qrtl/axls-custom `_ project on GitHub. + +You are welcome to contribute. diff --git a/stock_location_report_manager_layout/__init__.py b/stock_location_report_manager_layout/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/stock_location_report_manager_layout/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_location_report_manager_layout/__manifest__.py b/stock_location_report_manager_layout/__manifest__.py new file mode 100644 index 00000000..6ee12283 --- /dev/null +++ b/stock_location_report_manager_layout/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2026 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Stock Location Report Manager Layout", + "version": "16.0.1.0.0", + "category": "Inventory/Inventory", + "summary": "Add a readonly manager layout option to the locations report", + "author": "Quartile", + "website": "https://www.quartile.co", + "license": "AGPL-3", + "maintainers": ["nobuQuartile", "AungKoKoLin1997"], + "depends": ["stock"], + "data": [ + "views/stock_quant_views.xml", + ], + "installable": True, +} diff --git a/stock_location_report_manager_layout/i18n/ja.po b/stock_location_report_manager_layout/i18n/ja.po new file mode 100644 index 00000000..e4ea7b64 --- /dev/null +++ b/stock_location_report_manager_layout/i18n/ja.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_location_report_manager_layout +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-06-26 06:41+0000\n" +"PO-Revision-Date: 2026-06-26 06:41+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: stock_location_report_manager_layout +#: model_terms:ir.ui.view,arch_db:stock_location_report_manager_layout.view_stock_quant_tree_readonly_manager_layout +msgid "On Hand Quantity" +msgstr "手持在庫数" + +#. module: stock_location_report_manager_layout +#: model:ir.model,name:stock_location_report_manager_layout.model_stock_quant +msgid "Quants" +msgstr "保管ロット" + +#. module: stock_location_report_manager_layout +#: model_terms:ir.ui.view,arch_db:stock_location_report_manager_layout.view_stock_quant_tree_readonly_manager_layout +msgid "Total On Hand" +msgstr "手持在庫合計" diff --git a/stock_location_report_manager_layout/models/__init__.py b/stock_location_report_manager_layout/models/__init__.py new file mode 100644 index 00000000..70f8e6c8 --- /dev/null +++ b/stock_location_report_manager_layout/models/__init__.py @@ -0,0 +1 @@ +from . import stock_quant diff --git a/stock_location_report_manager_layout/models/stock_quant.py b/stock_location_report_manager_layout/models/stock_quant.py new file mode 100644 index 00000000..5756e765 --- /dev/null +++ b/stock_location_report_manager_layout/models/stock_quant.py @@ -0,0 +1,23 @@ +# Copyright 2026 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class StockQuant(models.Model): + _inherit = "stock.quant" + + def _get_quants_action(self, domain=None, extend=False): + action = super()._get_quants_action(domain=domain, extend=extend) + if self.env.user.has_group("stock.group_stock_manager"): + return action + readonly_view = self.env.ref( + "stock_location_report_manager_layout.view_stock_quant_tree_readonly_manager_layout" + ) + action["view_id"] = readonly_view.id + action["views"] = [(readonly_view.id, "list")] + [ + (view_id, view_type) + for view_id, view_type in action.get("views", []) + if view_type != "list" + ] + return action diff --git a/stock_location_report_manager_layout/pyproject.toml b/stock_location_report_manager_layout/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/stock_location_report_manager_layout/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_location_report_manager_layout/readme/CONTRIBUTORS.md b/stock_location_report_manager_layout/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..3318a653 --- /dev/null +++ b/stock_location_report_manager_layout/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [Quartile](https://www.quartile.co): + - Toshikimi Shigenobu + - Aung Ko Ko Lin diff --git a/stock_location_report_manager_layout/readme/DESCRIPTION.md b/stock_location_report_manager_layout/readme/DESCRIPTION.md new file mode 100644 index 00000000..1ef40999 --- /dev/null +++ b/stock_location_report_manager_layout/readme/DESCRIPTION.md @@ -0,0 +1,12 @@ +This module changes the Locations report (*Inventory > Reporting > +Locations*) so that non-managers see a read-only copy of the manager layout. + +Depending on the user's groups, the Locations report list view resolves to: + +- Stock managers: the existing editable manager layout (unchanged). +- All other users: a read-only copy of the manager layout, so they see the + richer manager column set (and its extension columns, such as expiration + date) without being able to create, edit or delete records. + +A module such as `stock_reporting_access` should be installed to let non-manager +users access the *Inventory > Reporting* menu item. diff --git a/stock_location_report_manager_layout/readme/USAGE.md b/stock_location_report_manager_layout/readme/USAGE.md new file mode 100644 index 00000000..5c9385b1 --- /dev/null +++ b/stock_location_report_manager_layout/readme/USAGE.md @@ -0,0 +1,4 @@ +1. Log in as a stock user who is not a stock manager. +2. Go to *Inventory > Reporting > Locations*. +3. The list shows the manager layout columns, but records cannot be created, + edited or deleted. diff --git a/stock_location_report_manager_layout/static/description/index.html b/stock_location_report_manager_layout/static/description/index.html new file mode 100644 index 00000000..57a7ae77 --- /dev/null +++ b/stock_location_report_manager_layout/static/description/index.html @@ -0,0 +1,451 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Stock Location Report Manager Layout

+ +

Beta License: AGPL-3 qrtl/axls-custom

+

This module changes the Locations report (Inventory > Reporting > +Locations) so that non-managers see a read-only copy of the manager +layout.

+

Depending on the user’s groups, the Locations report list view resolves +to:

+
    +
  • Stock managers: the existing editable manager layout (unchanged).
  • +
  • All other users: a read-only copy of the manager layout, so they see +the richer manager column set (and its extension columns, such as +expiration date) without being able to create, edit or delete +records.
  • +
+

A module such as stock_reporting_access should be installed to let +non-manager users access the Inventory > Reporting menu item.

+

Table of contents

+ +
+

Usage

+
    +
  1. Log in as a stock user who is not a stock manager.
  2. +
  3. Go to Inventory > Reporting > Locations.
  4. +
  5. The list shows the manager layout columns, but records cannot be +created, edited or deleted.
  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

+
    +
  • Quartile
  • +
+
+
+

Contributors

+
    +
  • Quartile:
      +
    • Toshikimi Shigenobu
    • +
    • Aung Ko Ko Lin
    • +
    +
  • +
+
+
+

Maintainers

+

Current maintainers:

+

nobuQuartile AungKoKoLin1997

+

This module is part of the qrtl/axls-custom project on GitHub.

+

You are welcome to contribute.

+
+
+
+
+ + diff --git a/stock_location_report_manager_layout/tests/__init__.py b/stock_location_report_manager_layout/tests/__init__.py new file mode 100644 index 00000000..ca7a2b36 --- /dev/null +++ b/stock_location_report_manager_layout/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_location_report_manager_layout diff --git a/stock_location_report_manager_layout/tests/test_stock_location_report_manager_layout.py b/stock_location_report_manager_layout/tests/test_stock_location_report_manager_layout.py new file mode 100644 index 00000000..d78e7fd3 --- /dev/null +++ b/stock_location_report_manager_layout/tests/test_stock_location_report_manager_layout.py @@ -0,0 +1,43 @@ +# Copyright 2026 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo.tests import TransactionCase, new_test_user, tagged + + +@tagged("post_install", "-at_install") +class TestStockLocationReportManagerLayout(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.standard_view = cls.env.ref("stock.view_stock_quant_tree") + cls.editable_view = cls.env.ref("stock.view_stock_quant_tree_editable") + cls.readonly_view = cls.env.ref( + "stock_location_report_manager_layout." + "view_stock_quant_tree_readonly_manager_layout" + ) + cls.user_plain = new_test_user( + cls.env, "srml_plain_user", groups="stock.group_stock_user" + ) + cls.user_manager = new_test_user( + cls.env, "srml_manager", groups="stock.group_stock_manager" + ) + + def _list_view_id(self, user, **ctx): + action = ( + self.env["stock.quant"] + .with_user(user) + .with_context(**ctx) + ._get_quants_action() + ) + return action["view_id"] + + def test_non_manager_gets_readonly_manager_layout(self): + self.assertEqual(self._list_view_id(self.user_plain), self.readonly_view.id) + + def test_manager_is_unaffected(self): + # Manager keeps the standard report view, and gets the editable layout in + # inventory mode -- never the read-only manager layout. + self.assertEqual(self._list_view_id(self.user_manager), self.standard_view.id) + self.assertEqual( + self._list_view_id(self.user_manager, inventory_mode=True), + self.editable_view.id, + ) diff --git a/stock_location_report_manager_layout/views/stock_quant_views.xml b/stock_location_report_manager_layout/views/stock_quant_views.xml new file mode 100644 index 00000000..957c65e1 --- /dev/null +++ b/stock_location_report_manager_layout/views/stock_quant_views.xml @@ -0,0 +1,24 @@ + + + + stock.quant.list.readonly.manager + stock.quant + + primary + 99 + + + 0 + 0 + 0 + + + + + + + +