diff --git a/product_security/README.rst b/product_security/README.rst new file mode 100644 index 00000000..c49f8af8 --- /dev/null +++ b/product_security/README.rst @@ -0,0 +1,60 @@ +================ +Product 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-qrtl%2Faxls--custom-lightgray.png?logo=github + :target: https://github.com/qrtl/axls-custom/tree/16.0/product_security + :alt: qrtl/axls-custom + +|badge1| |badge2| |badge3| + +This module restricts the updating of product categories for products to only those users +in the group_product_manager group. + +Background +~~~~~~~~~~ + +In certain situations, updating the product category can affect the costing method and stock valuation. +This module provides a control mechanism to ensure only authorized personnel can make such changes, +thereby safeguarding the integrity of the inventory and financial data. + +**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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Quartile Limited + +Maintainers +~~~~~~~~~~~ + +This module is part of the `qrtl/axls-custom `_ project on GitHub. + +You are welcome to contribute. diff --git a/product_security/__init__.py b/product_security/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/product_security/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_security/__manifest__.py b/product_security/__manifest__.py new file mode 100644 index 00000000..fdadd956 --- /dev/null +++ b/product_security/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Product Security", + "version": "16.0.1.0.0", + "category": "product", + "website": "https://www.quartile.co", + "author": "Quartile Limited", + "license": "AGPL-3", + "depends": ["product"], + "data": [ + "security/product_security.xml", + ], +} diff --git a/product_security/i18n/ja.po b/product_security/i18n/ja.po new file mode 100644 index 00000000..6e181a22 --- /dev/null +++ b/product_security/i18n/ja.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_security +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-10-13 05:58+0000\n" +"PO-Revision-Date: 2023-10-13 05:58+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: product_security +#: model:ir.model,name:product_security.model_product_template +msgid "Product" +msgstr "プロダクト" + +#. module: product_security +#: model:res.groups,name:product_security.group_product_manager +msgid "Product Manager" +msgstr "プロダクト管理者" + +#. module: product_security +#. odoo-python +#: code:addons/product_security/models/product_template.py:0 +#, python-format +msgid "" +"You are not allowed to update product category. Please contact administrator" +" as necessary." +msgstr "" +"プロダクトカテゴリを更新することは許可されていません。" +"必要に応じて、システム管理者にお問い合わせください。" diff --git a/product_security/models/__init__.py b/product_security/models/__init__.py new file mode 100644 index 00000000..e8fa8f6b --- /dev/null +++ b/product_security/models/__init__.py @@ -0,0 +1 @@ +from . import product_template diff --git a/product_security/models/product_template.py b/product_security/models/product_template.py new file mode 100644 index 00000000..3e912e80 --- /dev/null +++ b/product_security/models/product_template.py @@ -0,0 +1,20 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import _, models +from odoo.exceptions import UserError + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + def write(self, vals): + if "categ_id" in vals: + if not self.env.user.has_group("product_security.group_product_manager"): + raise UserError( + _( + "You are not allowed to update product category." + " Please contact administrator as necessary." + ) + ) + return super(ProductTemplate, self).write(vals) diff --git a/product_security/readme/DESCRIPTION.rst b/product_security/readme/DESCRIPTION.rst new file mode 100644 index 00000000..be6e494c --- /dev/null +++ b/product_security/readme/DESCRIPTION.rst @@ -0,0 +1,9 @@ +This module restricts the updating of product categories for products to only those users +in the group_product_manager group. + +Background +~~~~~~~~~~ + +In certain situations, updating the product category can affect the costing method and stock valuation. +This module provides a control mechanism to ensure only authorized personnel can make such changes, +thereby safeguarding the integrity of the inventory and financial data. diff --git a/product_security/security/product_security.xml b/product_security/security/product_security.xml new file mode 100644 index 00000000..726eb72b --- /dev/null +++ b/product_security/security/product_security.xml @@ -0,0 +1,8 @@ + + + + + Product Manager + + + diff --git a/product_security/static/description/index.html b/product_security/static/description/index.html new file mode 100644 index 00000000..489522b0 --- /dev/null +++ b/product_security/static/description/index.html @@ -0,0 +1,410 @@ + + + + + + +Product Security + + + +
+

Product Security

+ + +

Beta License: AGPL-3 qrtl/axls-custom

+

This module restricts the updating of product categories for products to only those users +in the group_product_manager group.

+
+

Background

+

In certain situations, updating the product category can affect the costing method and stock valuation. +This module provides a control mechanism to ensure only authorized personnel can make such changes, +thereby safeguarding the integrity of the inventory and financial data.

+

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

+

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

+
+ +
+
+

Authors

+
    +
  • Quartile Limited
  • +
+
+
+

Maintainers

+

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

+

You are welcome to contribute.

+
+
+ + diff --git a/setup/product_security/odoo/addons/product_security b/setup/product_security/odoo/addons/product_security new file mode 120000 index 00000000..febc407c --- /dev/null +++ b/setup/product_security/odoo/addons/product_security @@ -0,0 +1 @@ +../../../../product_security \ No newline at end of file diff --git a/setup/product_security/setup.py b/setup/product_security/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/product_security/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)