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
112 changes: 112 additions & 0 deletions partner_readonly_security/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=========================
Partner Readonly Security
=========================

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

.. |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-OCA%2Fpartner--contact-lightgray.png?logo=github
:target: https://github.com/OCA/partner-contact/tree/19.0/partner_readonly_security
:alt: OCA/partner-contact
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/partner-contact-19-0/partner-contact-19-0-partner_readonly_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/partner-contact&target_branch=19.0
:alt: Try me on Runboat

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

This module creates a specific permission to allow modification of
partners.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

Example use case: sales manager doesn't edit partners.

Usage
=====

1. Create or edit a user and uncheck the 'Partner edition' permission.
2. Go to any contact.
3. None can be created, modified or deleted.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/partner-contact/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/partner-contact/issues/new?body=module:%20partner_readonly_security%0Aversion:%2019.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>`__:

- Víctor Martínez
- Pedro M. Baeza

- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

- `Apik <https://apik.cloud>`__

- Michel Guiheneuf

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.

.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px
:target: https://github.com/victoralmau
:alt: victoralmau

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victoralmau|

This module is part of the `OCA/partner-contact <https://github.com/OCA/partner-contact/tree/19.0/partner_readonly_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 partner_readonly_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 partner_readonly_security/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Partner Readonly Security",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/partner-contact",
"version": "19.0.1.0.0",
"depends": ["base"],
"license": "AGPL-3",
"category": "Customer Relationship Management",
"data": ["security/partner_readonly_security_security.xml"],
"installable": True,
"maintainers": ["victoralmau"],
}
39 changes: 39 additions & 0 deletions partner_readonly_security/i18n/es.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:
# * partner_readonly_security
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-30 12:08+0000\n"
"PO-Revision-Date: 2024-05-30 14:09+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 3.0.1\n"

#. module: partner_readonly_security
#: model:ir.model,name:partner_readonly_security.model_res_partner
msgid "Contact"
msgstr "Contacto"

#. module: partner_readonly_security
#: model:res.groups,name:partner_readonly_security.group_partner_edition
msgid "Partner edition"
msgstr "Edición de contactos"

#. module: partner_readonly_security
#. odoo-python
#: code:addons/partner_readonly_security/models/res_partner.py:0
#, python-format
msgid ""
"Sorry, you are not allowed to create/edit partners. Please contact your "
"administrator for further information."
msgstr ""
"Lo sentimos, no tiene permiso para crear/editar contactos. Para más "
"información, póngase en contacto con su administrador."
38 changes: 38 additions & 0 deletions partner_readonly_security/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_readonly_security
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-01-21 12:06+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 5.6.2\n"

#. module: partner_readonly_security
#: model:ir.model,name:partner_readonly_security.model_res_partner
msgid "Contact"
msgstr "Contatto"

#. module: partner_readonly_security
#: model:res.groups,name:partner_readonly_security.group_partner_edition
msgid "Partner edition"
msgstr "Edizione partner"

#. module: partner_readonly_security
#. odoo-python
#: code:addons/partner_readonly_security/models/res_partner.py:0
#, python-format
msgid ""
"Sorry, you are not allowed to create/edit partners. Please contact your "
"administrator for further information."
msgstr ""
"Non si ha l'autorizzazione a creare/modificare i partner. Contattare "
"l'amministratore per altre informazioni."
32 changes: 32 additions & 0 deletions partner_readonly_security/i18n/partner_readonly_security.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_readonly_security
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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: partner_readonly_security
#: model:ir.model,name:partner_readonly_security.model_res_partner
msgid "Contact"
msgstr ""

#. module: partner_readonly_security
#: model:res.groups,name:partner_readonly_security.group_partner_edition
msgid "Partner edition"
msgstr ""

#. module: partner_readonly_security
#. odoo-python
#: code:addons/partner_readonly_security/models/res_partner.py:0
msgid ""
"Sorry, you are not allowed to create/edit partners. Please contact your "
"administrator for further information."
msgstr ""
3 changes: 3 additions & 0 deletions partner_readonly_security/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import res_partner
35 changes: 35 additions & 0 deletions partner_readonly_security/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import api, models
from odoo.exceptions import AccessError
from odoo.tools import config


class ResPartner(models.Model):
_inherit = "res.partner"

@api.model
def check_access(self, operation):
"""Simulate that you do not have ACLs so that the create, edit and delete
buttons are not displayed."""
user = self.env.user
group = "partner_readonly_security.group_partner_edition"
test_condition = not config["test_enable"] or (
config["test_enable"]
and self.env.context.get("test_partner_readonly_security")
)
if (
test_condition
and operation != "read"
and not self.env.su
and not user.has_group(group)
):
raise AccessError(
self.env._(
"Sorry, you are not allowed to create/edit partners. Please "
"contact your administrator for further information."
)
)

return super().check_access(operation)
3 changes: 3 additions & 0 deletions partner_readonly_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"
1 change: 1 addition & 0 deletions partner_readonly_security/readme/CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Example use case: sales manager doesn't edit partners.
7 changes: 7 additions & 0 deletions partner_readonly_security/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- Pedro M. Baeza
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
- Bhavesh Heliconia
- [Apik](https://apik.cloud)
- Michel Guiheneuf
2 changes: 2 additions & 0 deletions partner_readonly_security/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module creates a specific permission to allow modification of
partners.
3 changes: 3 additions & 0 deletions partner_readonly_security/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1. Create or edit a user and uncheck the 'Partner edition' permission.
2. Go to any contact.
3. None can be created, modified or deleted.
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_partner_edition" model="res.groups">
<field name="name">Partner edition</field>
<field name="user_ids" eval="[Command.link(ref('base.user_admin'))]" />
</record>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading