Skip to content

Commit

Permalink
[ADD] base_group_internal: New Module
Browse files Browse the repository at this point in the history
  • Loading branch information
KNVx authored and eantones committed Sep 25, 2024
1 parent ef66e3f commit d51a394
Show file tree
Hide file tree
Showing 12 changed files with 567 additions and 0 deletions.
62 changes: 62 additions & 0 deletions base_group_internal/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
===================
Base Group Internal
===================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9576c06acfaed505c902eb59d321c3c94e878d75561661d1057e69b6d7d94057
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-NuoBiT%2Fodoo--addons-lightgray.png?logo=github
:target: https://github.com/NuoBiT/odoo-addons/tree/17.0/base_group_internal
:alt: NuoBiT/odoo-addons

|badge1| |badge2| |badge3|

This module extends base to include security features.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/NuoBiT/odoo-addons/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/NuoBiT/odoo-addons/issues/new?body=module:%20base_group_internal%0Aversion:%2017.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
-------

* NuoBiT Solutions SL

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

- `NuoBiT <https://www.nuobit.com>`__:

- Kilian Niubo <[email protected]>

Maintainers
-----------

This module is part of the `NuoBiT/odoo-addons <https://github.com/NuoBiT/odoo-addons/tree/17.0/base_group_internal>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions base_group_internal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions base_group_internal/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright NuoBiT Solutions - Kilian Niubo <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

{
"name": "Base Group Internal",
"summary": "This module extends base to include security features.",
"version": "17.0.1.0.0",
"category": "Hidden",
"author": "NuoBiT Solutions SL",
"website": "https://github.com/NuoBiT/odoo-addons",
"license": "AGPL-3",
"depends": ["web"],
"data": [
"views/res_groups_views.xml",
],
}
2 changes: 2 additions & 0 deletions base_group_internal/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import res_groups
from . import res_users
14 changes: 14 additions & 0 deletions base_group_internal/models/res_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright NuoBiT Solutions - Kilian Niubo <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


from odoo import fields, models


class ResGroups(models.Model):
_inherit = "res.groups"

is_internal = fields.Boolean(
string="Internal Group",
help="Check this box if the group is an internal group.",
)
32 changes: 32 additions & 0 deletions base_group_internal/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright NuoBiT Solutions - Kilian Niubo <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import logging

from odoo import api, models

_logger = logging.getLogger(__name__)


class Users(models.Model):
_inherit = "res.users"

@api.depends("groups_id")
def _compute_share(self):
res = super()._compute_share()
internal_users = self.filtered_domain([("groups_id.is_internal", "=", True)])
internal_users.share = False
return res

@api.model
def has_group(self, group_ext_id):
has_group = super().has_group(group_ext_id)
if group_ext_id == "base.group_user":
has_group |= bool(self.groups_id.filtered(lambda x: x.is_internal))
return has_group

def _is_internal(self):
res = super()._is_internal()
if self.sudo().groups_id.filtered(lambda x: x.is_internal):
res = True
return res
3 changes: 3 additions & 0 deletions base_group_internal/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions base_group_internal/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [NuoBiT](https://www.nuobit.com):
- Kilian Niubo \<<[email protected]>\>
1 change: 1 addition & 0 deletions base_group_internal/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module extends base to include security features.
Binary file added base_group_internal/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d51a394

Please sign in to comment.