Skip to content

Commit

Permalink
[ADD] partner_risk_insurance_restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
toita86 committed Oct 29, 2024
1 parent 1a73908 commit 51c6114
Show file tree
Hide file tree
Showing 15 changed files with 656 additions and 0 deletions.
92 changes: 92 additions & 0 deletions partner_risk_insurance_security/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
===============================
Partner Risk Insurance Security
===============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a15148d51bb3109207bcfcc747b064f3c66b17366a2ef3e322f068b241da063e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fcredit--control-lightgray.png?logo=github
:target: https://github.com/OCA/credit-control/tree/14.0/partner_risk_insurance_security
:alt: OCA/credit-control
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/credit-control-14-0/credit-control-14-0-partner_risk_insurance_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/credit-control&target_branch=14.0
:alt: Try me on Runboat

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

Adds a group for the user that can access the insurance data

**Table of contents**

.. contents::
:local:

Usage
=====

Simply add the user to the 'Full Access to Credit Policy State' group
to enable editing of the 'Credit Insurance' fields that are otherwise read-only.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/credit-control/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/credit-control/issues/new?body=module:%20partner_risk_insurance_security%0Aversion:%2014.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
~~~~~~~

* Ooops404
* toita86

Contributors
~~~~~~~~~~~~

* `Ooops404 <https://www.ooops404.com/>`_:
* Eduard Brahas <[email protected]>

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-toita86| image:: https://github.com/toita86.png?size=40px
:target: https://github.com/toita86
:alt: toita86

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

|maintainer-toita86|

This module is part of the `OCA/credit-control <https://github.com/OCA/credit-control/tree/14.0/partner_risk_insurance_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_risk_insurance_security/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions partner_risk_insurance_security/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Partner Risk Insurance Security",
"version": "14.0.1.0.0",
"summary": "Risk insurance partner information are accessible only"
"being part of the Full Access to Credit Policy State group",
"author": "Ooops404," "toita86," "Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"website": "https://github.com/OCA/credit-control",
"depends": ["partner_risk_insurance"],
"category": "Credit Control",
"data": [
"security/groups.xml",
"security/ir.model.access.csv",
"views/res_partner_view.xml",
],
"installable": True,
"maintainers": ["toita86"],
}
1 change: 1 addition & 0 deletions partner_risk_insurance_security/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_partner
21 changes: 21 additions & 0 deletions partner_risk_insurance_security/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from odoo import api, fields, models


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

is_full_access_user = fields.Boolean(
string="Is Full Access User",
compute="_compute_is_full_access_user",
store=False,
)

@api.depends("user_id")
def _compute_is_full_access_user(self):
for partner in self:
partner.is_full_access_user = (
self.env.user
in self.env.ref(
"partner_risk_insurance_security.group_full_access_credit_policy_state"
).users
)
2 changes: 2 additions & 0 deletions partner_risk_insurance_security/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* `Ooops404 <https://www.ooops404.com/>`_:
* Eduard Brahas <[email protected]>
1 change: 1 addition & 0 deletions partner_risk_insurance_security/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds a group for the user that can access the insurance data
2 changes: 2 additions & 0 deletions partner_risk_insurance_security/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Simply add the user to the 'Full Access to Credit Policy State' group
to enable editing of the 'Credit Insurance' fields that are otherwise read-only.
9 changes: 9 additions & 0 deletions partner_risk_insurance_security/security/groups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<odoo>
<record id="group_full_access_credit_policy_state" model="res.groups">
<field name="name">Full Access to Credit Insurance Fields</field>
<field name="category_id" ref="base.module_category_sales_management" />
</record>
</odoo>
</odoo>
2 changes: 2 additions & 0 deletions partner_risk_insurance_security/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_full_access_credit_policy_state,res.partner,base.model_res_partner,partner_risk_insurance_security.group_full_access_credit_policy_state,1,1,1,1
Loading

0 comments on commit 51c6114

Please sign in to comment.