forked from Smile-SA/odoo_addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] #1086191 smile_access_control : migration to V15.0
- Loading branch information
imane
authored and
Boudmir Ibrahim
committed
Jan 20, 2022
1 parent
a9640f2
commit 6e5f426
Showing
19 changed files
with
1,539 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
============== | ||
Access Control | ||
============== | ||
|
||
.. |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-Smile_SA%2Fodoo_addons-lightgray.png?logo=github | ||
:target: https://github.com/Smile-SA/odoo_addons/tree/15.0/smile_access_control | ||
:alt: Smile-SA/odoo_addons | ||
|
||
|badge2| |badge3| | ||
|
||
This module allows to manage users' rights using profiles. | ||
|
||
Odoo's groups are a coherent set of rules that functionally consistent. Profiles allow you to combine several groups and effectively tailor users' access to each user. | ||
|
||
Here an exemple : | ||
|
||
* accounting group : create an invoice, modify an invoice, cancel an invoice | ||
* business develloper group : create a lead, modify data of lead, close a deal | ||
|
||
The CEO of an SME will probably belong to both groups. Profils allows to combine the both groups in one profil. | ||
|
||
This is an alternative way to manage users rights by functional profiles. | ||
|
||
Basically, a « profile » is a fictive user (res.users) tagged as a profile. | ||
|
||
It means that like before (with the basic rules of Odoo), | ||
you can add groups to your profile. | ||
|
||
Features: | ||
|
||
* You can associate a profile to created users. | ||
* You can add users by profile. | ||
* You can set fields to update for linked users. | ||
* You have the choice to update or not in write mode for associated users, | ||
with field 'Update users' in profiles. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
* Go to new menu **Settings > Users & Companies > User Profiles** and create the | ||
profiles you need. | ||
|
||
Usage | ||
===== | ||
|
||
* Go to new menu **Settings > Users & Companies > Users** and create a new | ||
user, choose the profile and after saving you will have user access rights set. | ||
|
||
Changelog | ||
========= | ||
|
||
**To test your profile, you need to set him as « active », | ||
which will be disabled afterwards at the next update.** | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/Smile-SA/odoo_addons/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/Smile-SA/odoo_addons/issues/new?body=module:%20smile_access_control%0Aversion:%2015.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. | ||
|
||
GDPR / EU Privacy | ||
================= | ||
|
||
This addons does not collect any data and does not set any browser cookies. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Smile SA | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Corentin Pouhet-Brunerie | ||
* Matthieu Choplin | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the Smile SA. | ||
|
||
Since 1991 Smile has been a pioneer of technology and also the European expert in open source solutions. | ||
|
||
.. image:: https://avatars0.githubusercontent.com/u/572339?s=200&v=4 | ||
:alt: Smile SA | ||
:target: https://www.smile.eu | ||
|
||
This module is part of the `odoo-addons <https://github.com/Smile-SA/odoo_addons>`_ project on GitHub. | ||
|
||
You are welcome to contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
# (C) 2022 Smile (<https://www.smile.eu>) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
from . import models | ||
|
||
from odoo import api, SUPERUSER_ID | ||
|
||
|
||
def uninstall_hook(cr, registry): | ||
""" Reset domain of native user act window. | ||
""" | ||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
env.ref('base.action_res_users').domain = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
# (C) 2022 Smile (<https://www.smile.eu>) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
{ | ||
"name": "Access Control", | ||
"version": "15.0.1.0.0", | ||
"author": "Smile", | ||
"license": 'LGPL-3', | ||
"category": "Tools", | ||
"description": "This module allows to manage users' rights using profiles.", | ||
"depends": ['base'], | ||
"data": [ | ||
"data/res_users_data.xml", | ||
"views/res_users_view.xml", | ||
"views/res_groups_view.xml", | ||
'views/res_company_view.xml', | ||
], | ||
"demo": [], | ||
"installable": True, | ||
"active": False, | ||
"uninstall_hook": "uninstall_hook", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<data noupdate="0"> | ||
|
||
<record model="res.users" id="base.user_root"> | ||
<field name="is_user_profile" eval="True"/> | ||
</record> | ||
|
||
</data> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * smile_access_control | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2022-01-20 15:29+0000\n" | ||
"PO-Revision-Date: 2022-01-20 15:29+0000\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: smile_access_control | ||
#: model:ir.model,name:smile_access_control.model_res_groups | ||
msgid "Access Groups" | ||
msgstr "Groupes d'accès" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model.fields,field_description:smile_access_control.field_res_groups__active | ||
msgid "Active" | ||
msgstr "Actif" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.actions.act_window,name:smile_access_control.action_administrators | ||
#: model:ir.ui.menu,name:smile_access_control.menu_action_administrators | ||
msgid "Administrators" | ||
msgstr "Administrateurs" | ||
|
||
#. module: smile_access_control | ||
#: model_terms:ir.ui.view,arch_db:smile_access_control.view_res_group_form | ||
msgid "Complete Access Controls" | ||
msgstr "Compléter la liste des contrôles d'accès" | ||
|
||
#. module: smile_access_control | ||
#: model_terms:ir.ui.view,arch_db:smile_access_control.view_user_profile_form | ||
msgid "Configuration" | ||
msgstr "Configuration" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model.fields,field_description:smile_access_control.field_res_users__field_ids | ||
msgid "Fields to update" | ||
msgstr "Champs à mettre à jour" | ||
|
||
#. module: smile_access_control | ||
#: model_terms:ir.ui.view,arch_db:smile_access_control.view_user_profile_form | ||
msgid "Fields to update for linked users" | ||
msgstr "Champs à mettre à jour au niveau des utilisateurs associés" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model.fields,help:smile_access_control.field_res_users__is_update_users | ||
msgid "" | ||
"If non checked, users associated to this profile will not be updated after " | ||
"creation" | ||
msgstr "Si non coché, les utilisateurs associés à ce profil ne seront pas mis à jour après création" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model.fields,field_description:smile_access_control.field_res_users__is_user_profile | ||
msgid "Is User Profile" | ||
msgstr "Est un profil utilisateur" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model,name:smile_access_control.model_ir_ui_menu | ||
msgid "Menu" | ||
msgstr "Menu" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model,name:smile_access_control.model_ir_model | ||
msgid "Models" | ||
msgstr "Modèles" | ||
|
||
#. module: smile_access_control | ||
#: model_terms:ir.ui.view,arch_db:smile_access_control.view_user_profile_form | ||
msgid "Options" | ||
msgstr "Options" | ||
|
||
#. module: smile_access_control | ||
#: model_terms:ir.ui.view,arch_db:smile_access_control.view_user_profile_form | ||
msgid "Profile ..." | ||
msgstr "Profil ..." | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model.constraint,message:smile_access_control.constraint_res_users_profile_without_profile_id | ||
msgid "Profile users cannot be linked to a profile!" | ||
msgstr "Les profils utilisateurs ne peuvent pas être liés à un profil !" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model.constraint,message:smile_access_control.constraint_res_users_active_admin_check | ||
msgid "The user with id = 2 must always be active!" | ||
msgstr "L'utilisateur avec id = 2 doit toujours être actif !" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model.fields,field_description:smile_access_control.field_res_users__is_update_users | ||
msgid "Update users after creation" | ||
msgstr "Mettre à jour les utilisateurs après création" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model.fields,field_description:smile_access_control.field_res_users__user_profile_id | ||
msgid "User Profile" | ||
msgstr "Profil utilisateur" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.actions.act_window,name:smile_access_control.action_res_user_profiles | ||
#: model:ir.ui.menu,name:smile_access_control.menu_action_res_user_profiles | ||
msgid "User Profiles" | ||
msgstr "Profils utilisateurs" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.actions.act_window,name:smile_access_control.action_res_users | ||
#: model:ir.model,name:smile_access_control.model_res_users | ||
#: model:ir.model.fields,field_description:smile_access_control.field_res_users__user_ids | ||
#: model_terms:ir.ui.view,arch_db:smile_access_control.view_user_profile_form | ||
msgid "Users" | ||
msgstr "Utilisateurs" | ||
|
||
#. module: smile_access_control | ||
#: model:ir.model.fields,field_description:smile_access_control.field_res_users__users_count | ||
msgid "Users Count" | ||
msgstr "Nombre d'utilisateurs" | ||
|
||
#. module: smile_access_control | ||
#: code:addons/smile_access_control/models/res_users.py:0 | ||
#, python-format | ||
msgid "You can't use %s as user profile !" | ||
msgstr "Vous ne pouvez pas utiliser %s comme profil utilisateur !" | ||
|
||
#. module: smile_access_control | ||
#: code:addons/smile_access_control/models/res_users.py:0 | ||
#, python-format | ||
msgid "_update_from_profile accepts only users linked to a same profile" | ||
msgstr "" | ||
"_update_from_profile accepte uniquement des utilisateurs liés à un même " | ||
"profil" | ||
|
||
#. module: smile_access_control | ||
#: code:addons/smile_access_control/models/res_users.py:0 | ||
#, python-format | ||
msgid "_update_from_profile doesn't manage fields.One2many" | ||
msgstr "_update_from_profile ne gère pas les fields.One2many" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import ir_ui_menu | ||
from . import res_users | ||
from . import res_groups | ||
from . import res_partner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# (C) 2022 Smile (<https://www.smile.eu>) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import api, models | ||
|
||
|
||
class IrUiMenu(models.Model): | ||
_inherit = 'ir.ui.menu' | ||
|
||
@api.model | ||
def _search( | ||
self, args, offset=0, limit=None, order=None, count=False, | ||
access_rights_uid=None): | ||
""" Hide Administrators menu to users that are not ERP managers | ||
""" | ||
if not self.user_has_groups('base.group_system'): | ||
menu_id = self.env['ir.model.data']._xmlid_to_res_id('smile_access_control.menu_action_administrators') | ||
args = [('id', '!=', menu_id)] + (args or []) | ||
return super(IrUiMenu, self)._search(args, offset, limit, order, count, access_rights_uid) |
Oops, something went wrong.