Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions pos_product_cost_security/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
=========================
PoS Product Cost Security
=========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c15b3fb7b7abfd380a0bebcec9cb5683ea92ba1f822515e4b7e917a82aca9923
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-OCA%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/18.0/pos_product_cost_security
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-pos_product_cost_security
: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/product-attribute&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This is a glue module to avoid permission errors when loading data in
the Point of Sale if the user has no ``standard_price`` (cost) field
permissions.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/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 <https://github.com/OCA/product-attribute/issues/new?body=module:%20pos_product_cost_security%0Aversion:%2018.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
-------

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:

- David Vidal

- `SerpentCS <https://www.serpentcs.com>`__:

- Parvez Qureshi <parvez.qureshi@serpentcs.com>

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.

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/18.0/pos_product_cost_security>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions pos_product_cost_security/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions pos_product_cost_security/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2021 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "PoS Product Cost Security",
"summary": "Compatibility between Point of Sale and Product Cost Security",
"version": "18.0.1.0.0",
"category": "Product",
"website": "https://github.com/OCA/product-attribute",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"depends": ["product_cost_security", "point_of_sale"],
}
39 changes: 39 additions & 0 deletions pos_product_cost_security/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_product_cost_security
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-06-24 14:38+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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 4.17\n"

#. module: pos_product_cost_security
#: model:ir.model,name:pos_product_cost_security.model_pos_session
msgid "Point of Sale Session"
msgstr "Sessione punto vendita"

#. module: pos_product_cost_security
#: model:ir.model,name:pos_product_cost_security.model_product_product
msgid "Product Variant"
msgstr "Variante prodotto"

#~ msgid "Display Name"
#~ msgstr "Nome visualizzato"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Ultima modifica il"

#~ msgid "Product"
#~ msgstr "Prodotto"
24 changes: 24 additions & 0 deletions pos_product_cost_security/i18n/pos_product_cost_security.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_product_cost_security
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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"

#. module: pos_product_cost_security
#: model:ir.model,name:pos_product_cost_security.model_pos_session
msgid "Point of Sale Session"
msgstr ""

#. module: pos_product_cost_security
#: model:ir.model,name:pos_product_cost_security.model_product_product
msgid "Product Variant"
msgstr ""
2 changes: 2 additions & 0 deletions pos_product_cost_security/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import pos_load_mixin
from . import product_product
16 changes: 16 additions & 0 deletions pos_product_cost_security/models/pos_load_mixin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from odoo import api, models


class PosLoadMixin(models.AbstractModel):
_inherit = "pos.load.mixin"

@api.model
def with_user(self, user):
ctx = dict(self.env.context)
ctx["pos_override_cost_security"] = True
return super().with_user(user).with_context(**ctx)

def with_env(self, env):
ctx = dict(env.context)
ctx["pos_override_cost_security"] = True
return super().with_env(env(context=ctx))
20 changes: 20 additions & 0 deletions pos_product_cost_security/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2021 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models


class ProductProduct(models.Model):
_inherit = "product.product"

def check_field_access_rights(self, operation, fields):
override_cost_security = (
self.env.context.get("pos_override_cost_security")
and self.env.user.has_group("point_of_sale.group_pos_user")
and not self.env.user.has_group("product_cost_security.group_product_cost")
and "standard_price" in fields
)
if override_cost_security:
return super(ProductProduct, self.sudo()).check_field_access_rights(
operation, fields
)
return super().check_field_access_rights(operation, fields)
3 changes: 3 additions & 0 deletions pos_product_cost_security/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
6 changes: 6 additions & 0 deletions pos_product_cost_security/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- [Tecnativa](https://www.tecnativa.com):
- David Vidal

- [SerpentCS](https://www.serpentcs.com):
- Parvez Qureshi \<<parvez.qureshi@serpentcs.com>\>

3 changes: 3 additions & 0 deletions pos_product_cost_security/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is a glue module to avoid permission errors when loading data in
the Point of Sale if the user has no `standard_price` (cost) field
permissions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading