Skip to content

Commit

Permalink
[16.0][3550][ADD] product_security (#48)
Browse files Browse the repository at this point in the history
* [ADD] product_security
  • Loading branch information
AungKoKoLin1997 authored Oct 18, 2023
1 parent 94f45ff commit 3776055
Show file tree
Hide file tree
Showing 11 changed files with 567 additions and 0 deletions.
60 changes: 60 additions & 0 deletions product_security/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/qrtl/axls-custom/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 <https://github.com/qrtl/axls-custom/issues/new?body=module:%20product_security%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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 <https://github.com/qrtl/axls-custom/tree/16.0/product_security>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions product_security/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions product_security/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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",
],
}
37 changes: 37 additions & 0 deletions product_security/i18n/ja.po
Original file line number Diff line number Diff line change
@@ -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 ""
"プロダクトカテゴリを更新することは許可されていません。"
"必要に応じて、システム管理者にお問い合わせください。"
1 change: 1 addition & 0 deletions product_security/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_template
20 changes: 20 additions & 0 deletions product_security/models/product_template.py
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 9 additions & 0 deletions product_security/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 8 additions & 0 deletions product_security/security/product_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Product Management Group -->
<record id="group_product_manager" model="res.groups">
<field name="name">Product Manager</field>
<field name="category_id" ref="base.module_category_hidden" />
</record>
</odoo>
Loading

0 comments on commit 3776055

Please sign in to comment.