Skip to content

Commit

Permalink
[ADD] product_security
Browse files Browse the repository at this point in the history
  • Loading branch information
AungKoKoLin1997 committed Oct 17, 2023
1 parent ee63334 commit 6a87192
Show file tree
Hide file tree
Showing 118 changed files with 379 additions and 37 deletions.
2 changes: 1 addition & 1 deletion account_financial_report_extended/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"summary": "",
"category": "Stock",
"author": "Quartile Limited",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"license": "AGPL-3",
"depends": ["account_financial_report"],
"data": ["wizard/general_ledger_wizard_view.xml"],
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_filter_adj/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.1",
"category": "Accounting",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "LGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_memo/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Accounting",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_report_industry/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Invoices",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "LGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_report_vat/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Accounting",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_sent_date/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.1.0",
"category": "Accounting",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_validate_adj/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Accounting",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion account_payment_evidence_status/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Purchase",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion account_view_adj_asx/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.1.1",
"category": "Accounting",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion delivery_adj_asx/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.1.0",
"category": "Stock",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion group_3pl/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Security",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion partner_statement_filename_adj/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Accounting & Finance",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion partner_view_adj_asx/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.1",
"category": "Contact",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "LGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion product_permission_adj_asx/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Product",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
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
17 changes: 17 additions & 0 deletions product_security/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Product Security",
"summary": "",
"version": "12.0.1.0.0",
"category": "Product",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"depends": ["product"],
"data": [
"security/product_security.xml",
"views/product_template_views.xml"
],
"installable": True,
}
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
40 changes: 40 additions & 0 deletions product_security/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, fields, models
from odoo.exceptions import UserError


class ProductTemplate(models.Model):
_inherit = "product.template"

standard_price = fields.Float(track_visibility='onchange')
update_cost = fields.Boolean()

def write(self, vals):
if "standard_price" in vals:
if not self.env.user.has_group("product_security.group_product_manager"):
raise UserError(
_(
"You are about to update the cost field. This field is "
"auto-calculated by Odoo and is an 'Weighted Average Value' of "
"one unit of this product in current inventory. This is "
"not the 'Price' or 'Cost' to buy this item -- that is "
"set in the 'Purchase' TAB. This value should not be "
"modified unless there are very unusual circumstances. "
"In such a situation, please make sure to write a detailed "
"'Log' below of what you are changing (from what to what)"
"and why."
)
)
if not vals.get('update_cost', self.update_cost):
raise UserError(
_(
"You are about to update the cost. If you wish to "
"proceed with the cost update, please set the 'Update Cost'"
"field to 'True' and save the record again. "
"Otherwise, please discard these changes."
)
)
return super(ProductTemplate, self).write(vals)
2 changes: 2 additions & 0 deletions product_security/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module restricts the updating of standard price for products to only those users
in the group_product_manager group.
7 changes: 7 additions & 0 deletions product_security/security/product_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<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>
13 changes: 13 additions & 0 deletions product_security/views/product_template_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.common.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='company_id']" position="after">
<field name="update_cost" groups="product_security.group_product_manager" />
</xpath>
</field>
</record>
</odoo>
2 changes: 1 addition & 1 deletion purchase_order_adj_asx/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Purchase",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion purchase_stockrule_adj/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Sale & Purchase",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
inflect
xlsxwriter
xlrd
# generated from manifests external_dependencies
2 changes: 1 addition & 1 deletion sale_delivery_client_order_ref/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Sales",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion sale_invoice_enduser/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Sales",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "LGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion sale_order_additional_info/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.1",
"category": "Sales",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion sale_order_amount_history/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Sales Order Amount History",
"version": "12.0.1.1.0",
"category": "Sales",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion sale_order_invoicing_policy/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Sale",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion sale_order_line_view/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.1",
"category": "Sales",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion sale_partner_shipping_address_sales_amount/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Sales",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion sale_report_industry/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Sales",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "LGPL-3",
"installable": True,
Expand Down
2 changes: 1 addition & 1 deletion sale_tier_validation_quotation_print/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"support a tier validation process.",
"version": "12.0.1.0.0",
"category": "Sale",
"website": "https://quartile.co",
"website": "https://www.quartile.co",
"author": "Open Source Integrators, "
"Odoo Community Association (OCA), "
"Quartile Limited",
Expand Down
2 changes: 1 addition & 1 deletion sale_view_adj_asx/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Sales",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
2 changes: 2 additions & 0 deletions setup/.setuptools-odoo-make-default-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# addons listed in this file are ignored by
# setuptools-odoo-make-default (one addon per line)
2 changes: 2 additions & 0 deletions setup/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
To learn more about this directory, please visit
https://pypi.python.org/pypi/setuptools-odoo
6 changes: 6 additions & 0 deletions setup/account_financial_report_extended/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
6 changes: 6 additions & 0 deletions setup/account_financial_risk_ext/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
6 changes: 6 additions & 0 deletions setup/account_invoice_filter_adj/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
6 changes: 6 additions & 0 deletions setup/account_invoice_memo/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
6 changes: 6 additions & 0 deletions setup/account_invoice_report_industry/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
6 changes: 6 additions & 0 deletions setup/account_invoice_report_vat/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading

0 comments on commit 6a87192

Please sign in to comment.