mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[9.0][ADD] - base_user_role_history
This commit is contained in:
committed by
Mohamed Osman
parent
b6f58742ca
commit
d85b7da4cc
97
base_user_role_history/README.rst
Normal file
97
base_user_role_history/README.rst
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
======================
|
||||||
|
Base User Role History
|
||||||
|
======================
|
||||||
|
|
||||||
|
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
|
!! changes will be overwritten. !!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
.. |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%2Fserver--tools-lightgray.png?logo=github
|
||||||
|
:target: https://github.com/OCA/server-tools/tree/9.0/base_user_role_history
|
||||||
|
:alt: OCA/server-tools
|
||||||
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
|
:target: https://translation.odoo-community.org/projects/server-tools-9-0/server-tools-9-0-base_user_role_history
|
||||||
|
:alt: Translate me on Weblate
|
||||||
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
|
:target: https://runbot.odoo-community.org/runbot/149/9.0
|
||||||
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
|
This addon provides history for roles modifications on users.
|
||||||
|
Each time a role is added/updated/unlinked on a user, a new role history line
|
||||||
|
is created mentioning what changes were made and who made them.
|
||||||
|
Theses informations are directly accessible from users via a smart button.
|
||||||
|
|
||||||
|
**Table of contents**
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
|
||||||
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
|
Changes on user roles are easily accessible via a button on user form view.
|
||||||
|
|
||||||
|
Known issues / Roadmap
|
||||||
|
======================
|
||||||
|
|
||||||
|
Since roles on role history line have 'cascade' ondelete, role deletion leads
|
||||||
|
to role history line deletion. In order to keep history even in the case of
|
||||||
|
a role deletion, module could be upgraded.
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
|
||||||
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/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/OCA/server-tools/issues/new?body=module:%20base_user_role_history%0Aversion:%209.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
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
* ACSONE SA/NV
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
* Benoit Aimont <benoit.aimont@acsone.eu> (https://acsone.eu)
|
||||||
|
* Thomas Binsfeld <thomas.binsfeld@acsone.eu> (https://acsone.eu)
|
||||||
|
|
||||||
|
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-ThomasBinsfeld| image:: https://github.com/ThomasBinsfeld.png?size=40px
|
||||||
|
:target: https://github.com/ThomasBinsfeld
|
||||||
|
:alt: ThomasBinsfeld
|
||||||
|
|
||||||
|
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||||
|
|
||||||
|
|maintainer-ThomasBinsfeld|
|
||||||
|
|
||||||
|
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/9.0/base_user_role_history>`_ project on GitHub.
|
||||||
|
|
||||||
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
1
base_user_role_history/__init__.py
Normal file
1
base_user_role_history/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
30
base_user_role_history/__openerp__.py
Normal file
30
base_user_role_history/__openerp__.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2019 ACSONE SA/NV
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Base User Role History',
|
||||||
|
'summary': """
|
||||||
|
This module allows to track the changes on users roles.""",
|
||||||
|
'version': '9.0.1.0.0',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'author': 'ACSONE SA/NV, '
|
||||||
|
'Odoo Community Association (OCA)',
|
||||||
|
'website': 'https://github.com/OCA/server-tools',
|
||||||
|
'depends': [
|
||||||
|
# Odoo
|
||||||
|
'mail',
|
||||||
|
# OCA
|
||||||
|
'base_user_role',
|
||||||
|
'base_suspend_security',
|
||||||
|
],
|
||||||
|
'data': [
|
||||||
|
'security/base_user_role_line_history.xml',
|
||||||
|
'views/base_user_role_line_history.xml',
|
||||||
|
'views/res_users.xml',
|
||||||
|
],
|
||||||
|
'development_status': 'Beta',
|
||||||
|
'maintainers': [
|
||||||
|
'ThomasBinsfeld'
|
||||||
|
],
|
||||||
|
}
|
||||||
169
base_user_role_history/i18n/base_user_role_history.pot
Normal file
169
base_user_role_history/i18n/base_user_role_history.pot
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * base_user_role_history
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 9.0c\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2019-09-30 11:50+0000\n"
|
||||||
|
"PO-Revision-Date: 2019-09-30 11:50+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: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.res_users_form_view
|
||||||
|
msgid "<span class=\"o_stat_text\">Last update of roles</span>"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_performed_action
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "Action"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_is_enabled
|
||||||
|
msgid "Active after edit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_is_enabled
|
||||||
|
msgid "Active before edit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: selection:base.user.role.line.history,performed_action:0
|
||||||
|
msgid "Add"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_create_uid
|
||||||
|
msgid "Created by"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_create_date
|
||||||
|
msgid "Created on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_tree_view
|
||||||
|
msgid "Date and time of edition"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: selection:base.user.role.line.history,performed_action:0
|
||||||
|
msgid "Delete"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_display_name
|
||||||
|
msgid "Display Name"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: selection:base.user.role.line.history,performed_action:0
|
||||||
|
msgid "Edit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
|
||||||
|
msgid "Edited user"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_tree_view
|
||||||
|
msgid "Editor"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "Group By"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model,name:base_user_role_history.model_base_user_role_line_history
|
||||||
|
msgid "History of user roles"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_id
|
||||||
|
msgid "ID"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history___last_update
|
||||||
|
msgid "Last Modified on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_write_uid
|
||||||
|
msgid "Last Updated by"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_write_date
|
||||||
|
msgid "Last Updated on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_res_users_last_role_line_modification
|
||||||
|
msgid "Last roles modification"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_date_to
|
||||||
|
msgid "New end date"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_role_id
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "New role"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_date_from
|
||||||
|
msgid "New start date"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_date_to
|
||||||
|
msgid "Old end date"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_role_id
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "Old role"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_date_from
|
||||||
|
msgid "Old start date"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: code:addons/base_user_role_history/models/res_users.py:70
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.res_users_form_view
|
||||||
|
#, python-format
|
||||||
|
msgid "Roles history"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_user_id
|
||||||
|
msgid "User"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model,name:base_user_role_history.model_res_users
|
||||||
|
msgid "Users"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
170
base_user_role_history/i18n/fr.po
Normal file
170
base_user_role_history/i18n/fr.po
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * base_user_role_history
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 9.0c\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2019-09-30 11:51+0000\n"
|
||||||
|
"PO-Revision-Date: 2019-09-30 11:51+0000\n"
|
||||||
|
"Last-Translator: <>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: fr\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: \n"
|
||||||
|
"Plural-Forms: \n"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.res_users_form_view
|
||||||
|
msgid "<span class=\"o_stat_text\">Last update of roles</span>"
|
||||||
|
msgstr "<span class=\"o_stat_text\">Dernière modification des rôles</span>"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_performed_action
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "Action"
|
||||||
|
msgstr "Action"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_is_enabled
|
||||||
|
msgid "Active after edit"
|
||||||
|
msgstr "Actif après édition"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_is_enabled
|
||||||
|
msgid "Active before edit"
|
||||||
|
msgstr "Actif avant édition"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: selection:base.user.role.line.history,performed_action:0
|
||||||
|
msgid "Add"
|
||||||
|
msgstr "Ajouter"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_create_uid
|
||||||
|
msgid "Created by"
|
||||||
|
msgstr "Créé par"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_create_date
|
||||||
|
msgid "Created on"
|
||||||
|
msgstr "Créé le"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_tree_view
|
||||||
|
msgid "Date and time of edition"
|
||||||
|
msgstr "Date et heure de modification"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: selection:base.user.role.line.history,performed_action:0
|
||||||
|
msgid "Delete"
|
||||||
|
msgstr "Supprimer"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_display_name
|
||||||
|
msgid "Display Name"
|
||||||
|
msgstr "Nom affiché"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: selection:base.user.role.line.history,performed_action:0
|
||||||
|
msgid "Edit"
|
||||||
|
msgstr "Modifier"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
|
||||||
|
msgid "Edited user"
|
||||||
|
msgstr "Utilisateur modifié"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_tree_view
|
||||||
|
msgid "Editor"
|
||||||
|
msgstr "Utilisateur modificateur"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "Group By"
|
||||||
|
msgstr "Regrouper par"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model,name:base_user_role_history.model_base_user_role_line_history
|
||||||
|
msgid "History of user roles"
|
||||||
|
msgstr "Historique des rôles de l'utilisateur"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_id
|
||||||
|
msgid "ID"
|
||||||
|
msgstr "ID"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history___last_update
|
||||||
|
msgid "Last Modified on"
|
||||||
|
msgstr "Dernière modification le"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_write_uid
|
||||||
|
msgid "Last Updated by"
|
||||||
|
msgstr "Mis à jour par"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_write_date
|
||||||
|
msgid "Last Updated on"
|
||||||
|
msgstr "Mis à jour le"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_res_users_last_role_line_modification
|
||||||
|
msgid "Last roles modification"
|
||||||
|
msgstr "Dernière modification des rôles"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_date_to
|
||||||
|
msgid "New end date"
|
||||||
|
msgstr "Nouvelle date de fin"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_role_id
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "New role"
|
||||||
|
msgstr "Nouveau rôle"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_date_from
|
||||||
|
msgid "New start date"
|
||||||
|
msgstr "Nouvelle date de début"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_date_to
|
||||||
|
msgid "Old end date"
|
||||||
|
msgstr "Ancienne date de fin"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_role_id
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "Old role"
|
||||||
|
msgstr "Ancien rôle"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_date_from
|
||||||
|
msgid "Old start date"
|
||||||
|
msgstr "Ancienne date de début"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: code:addons/base_user_role_history/models/res_users.py:70
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.res_users_form_view
|
||||||
|
#, python-format
|
||||||
|
msgid "Roles history"
|
||||||
|
msgstr "Historique des rôles"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_user_id
|
||||||
|
msgid "User"
|
||||||
|
msgstr "Utilisateur"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model,name:base_user_role_history.model_res_users
|
||||||
|
msgid "Users"
|
||||||
|
msgstr "Utilisateurs"
|
||||||
|
|
||||||
170
base_user_role_history/i18n/fr_BE.po
Normal file
170
base_user_role_history/i18n/fr_BE.po
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * base_user_role_history
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 9.0c\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2019-09-30 11:50+0000\n"
|
||||||
|
"PO-Revision-Date: 2019-09-30 11:50+0000\n"
|
||||||
|
"Last-Translator: <>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: fr_BE\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: \n"
|
||||||
|
"Plural-Forms: \n"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.res_users_form_view
|
||||||
|
msgid "<span class=\"o_stat_text\">Last update of roles</span>"
|
||||||
|
msgstr "<span class=\"o_stat_text\">Dernière modification des rôles</span>"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_performed_action
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "Action"
|
||||||
|
msgstr "Action"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_is_enabled
|
||||||
|
msgid "Active after edit"
|
||||||
|
msgstr "Actif après édition"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_is_enabled
|
||||||
|
msgid "Active before edit"
|
||||||
|
msgstr "Actif avant édition"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: selection:base.user.role.line.history,performed_action:0
|
||||||
|
msgid "Add"
|
||||||
|
msgstr "Ajouter"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_create_uid
|
||||||
|
msgid "Created by"
|
||||||
|
msgstr "Créé par"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_create_date
|
||||||
|
msgid "Created on"
|
||||||
|
msgstr "Créé le"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_tree_view
|
||||||
|
msgid "Date and time of edition"
|
||||||
|
msgstr "Date et heure de modification"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: selection:base.user.role.line.history,performed_action:0
|
||||||
|
msgid "Delete"
|
||||||
|
msgstr "Supprimer"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_display_name
|
||||||
|
msgid "Display Name"
|
||||||
|
msgstr "Nom affiché"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: selection:base.user.role.line.history,performed_action:0
|
||||||
|
msgid "Edit"
|
||||||
|
msgstr "Modifier"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
|
||||||
|
msgid "Edited user"
|
||||||
|
msgstr "Utilisateur modifié"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_tree_view
|
||||||
|
msgid "Editor"
|
||||||
|
msgstr "Utilisateur modificateur"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "Group By"
|
||||||
|
msgstr "Regrouper par"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model,name:base_user_role_history.model_base_user_role_line_history
|
||||||
|
msgid "History of user roles"
|
||||||
|
msgstr "Historique des rôles de l'utilisateur"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_id
|
||||||
|
msgid "ID"
|
||||||
|
msgstr "ID"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history___last_update
|
||||||
|
msgid "Last Modified on"
|
||||||
|
msgstr "Dernière modification le"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_write_uid
|
||||||
|
msgid "Last Updated by"
|
||||||
|
msgstr "Derniere fois mis à jour par"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_write_date
|
||||||
|
msgid "Last Updated on"
|
||||||
|
msgstr "Dernière mis à jour le"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_res_users_last_role_line_modification
|
||||||
|
msgid "Last roles modification"
|
||||||
|
msgstr "Dernière modification des rôles"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_date_to
|
||||||
|
msgid "New end date"
|
||||||
|
msgstr "Nouvelle date de fin"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_role_id
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "New role"
|
||||||
|
msgstr "Nouveau rôle"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_date_from
|
||||||
|
msgid "New start date"
|
||||||
|
msgstr "Nouvelle date de début"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_date_to
|
||||||
|
msgid "Old end date"
|
||||||
|
msgstr "Ancienne date de fin"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_role_id
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
|
||||||
|
msgid "Old role"
|
||||||
|
msgstr "Ancien rôle"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_date_from
|
||||||
|
msgid "Old start date"
|
||||||
|
msgstr "Ancienne date de début"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: code:addons/base_user_role_history/models/res_users.py:70
|
||||||
|
#: model:ir.ui.view,arch_db:base_user_role_history.res_users_form_view
|
||||||
|
#, python-format
|
||||||
|
msgid "Roles history"
|
||||||
|
msgstr "Historique des rôles"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_user_id
|
||||||
|
msgid "User"
|
||||||
|
msgstr "Utilisateur"
|
||||||
|
|
||||||
|
#. module: base_user_role_history
|
||||||
|
#: model:ir.model,name:base_user_role_history.model_res_users
|
||||||
|
msgid "Users"
|
||||||
|
msgstr "Utilisateurs"
|
||||||
|
|
||||||
2
base_user_role_history/models/__init__.py
Normal file
2
base_user_role_history/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
from . import res_users
|
||||||
|
from . import base_user_role_line_history
|
||||||
145
base_user_role_history/models/base_user_role_line_history.py
Normal file
145
base_user_role_history/models/base_user_role_line_history.py
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2019 ACSONE SA/NV
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class BaseUserRoleLineHistory(models.Model):
|
||||||
|
_name = 'base.user.role.line.history'
|
||||||
|
_description = "History of user roles"
|
||||||
|
_order = 'id desc'
|
||||||
|
|
||||||
|
performed_action = fields.Selection(
|
||||||
|
string="Action",
|
||||||
|
selection=[
|
||||||
|
('add', 'Add'),
|
||||||
|
('unlink', 'Delete'),
|
||||||
|
('edit', 'Edit')
|
||||||
|
],
|
||||||
|
required=True,
|
||||||
|
readonly=True,
|
||||||
|
)
|
||||||
|
user_id = fields.Many2one(
|
||||||
|
string="User",
|
||||||
|
comodel_name='res.users',
|
||||||
|
ondelete='cascade',
|
||||||
|
readonly=True,
|
||||||
|
index=True,
|
||||||
|
)
|
||||||
|
old_role_id = fields.Many2one(
|
||||||
|
string="Old role",
|
||||||
|
comodel_name='res.users.role',
|
||||||
|
ondelete='cascade',
|
||||||
|
readonly=True,
|
||||||
|
index=True,
|
||||||
|
)
|
||||||
|
new_role_id = fields.Many2one(
|
||||||
|
string="New role",
|
||||||
|
comodel_name='res.users.role',
|
||||||
|
ondelete='cascade',
|
||||||
|
readonly=True,
|
||||||
|
index=True,
|
||||||
|
)
|
||||||
|
old_date_from = fields.Date(
|
||||||
|
string="Old start date",
|
||||||
|
readonly=True,
|
||||||
|
)
|
||||||
|
new_date_from = fields.Date(
|
||||||
|
string="New start date",
|
||||||
|
readonly=True,
|
||||||
|
)
|
||||||
|
old_date_to = fields.Date(
|
||||||
|
string="Old end date",
|
||||||
|
readonly=True,
|
||||||
|
)
|
||||||
|
new_date_to = fields.Date(
|
||||||
|
string="New end date",
|
||||||
|
readonly=True,
|
||||||
|
)
|
||||||
|
old_is_enabled = fields.Boolean(
|
||||||
|
string="Active before edit",
|
||||||
|
readonly=True,
|
||||||
|
)
|
||||||
|
new_is_enabled = fields.Boolean(
|
||||||
|
string="Active after edit",
|
||||||
|
readonly=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _prepare_create_from_vals(
|
||||||
|
self,
|
||||||
|
old_role_line_values_by_user,
|
||||||
|
new_role_line_values_by_user
|
||||||
|
):
|
||||||
|
role_history_line_vals_by_role_line = {}
|
||||||
|
for key, value in new_role_line_values_by_user.items():
|
||||||
|
old_vals = old_role_line_values_by_user.get(key, {})
|
||||||
|
new_vals = value
|
||||||
|
# Manage deletion of role lines and old values of modified lines
|
||||||
|
for role_line_id, role_line_vals in old_vals.items():
|
||||||
|
action = 'unlink' if role_line_id not in new_vals else 'edit'
|
||||||
|
if action == 'edit':
|
||||||
|
# Skip if no change
|
||||||
|
if not any(
|
||||||
|
role_line_vals[k] != new_vals[role_line_id][k]
|
||||||
|
for k in role_line_vals
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
role_history_line_vals_by_role_line.setdefault(
|
||||||
|
role_line_id, {}
|
||||||
|
)
|
||||||
|
role_history_line_vals_by_role_line[role_line_id].update({
|
||||||
|
'performed_action': action,
|
||||||
|
'user_id': role_line_vals['user_id'],
|
||||||
|
'old_role_id': role_line_vals['role_id'],
|
||||||
|
'old_date_from': role_line_vals['date_from'],
|
||||||
|
'old_date_to': role_line_vals['date_to'],
|
||||||
|
'old_is_enabled': role_line_vals['is_enabled'],
|
||||||
|
})
|
||||||
|
# Manage addition of role lines and new values of modified ones
|
||||||
|
for role_line_id, role_line_vals in new_vals.items():
|
||||||
|
action = 'add' if role_line_id not in old_vals else 'edit'
|
||||||
|
if action == 'edit':
|
||||||
|
# Skip if no change
|
||||||
|
if not any(
|
||||||
|
role_line_vals[k] != old_vals[role_line_id][k]
|
||||||
|
for k in role_line_vals
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
role_history_line_vals_by_role_line.setdefault(
|
||||||
|
role_line_id, {}
|
||||||
|
)
|
||||||
|
role_history_line_vals_by_role_line[role_line_id].update({
|
||||||
|
'performed_action': action,
|
||||||
|
'user_id': role_line_vals['user_id'],
|
||||||
|
'new_role_id': role_line_vals['role_id'],
|
||||||
|
'new_date_from': role_line_vals['date_from'],
|
||||||
|
'new_date_to': role_line_vals['date_to'],
|
||||||
|
'new_is_enabled': role_line_vals['is_enabled'],
|
||||||
|
})
|
||||||
|
return role_history_line_vals_by_role_line
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def create_from_vals(
|
||||||
|
self,
|
||||||
|
old_role_line_values_by_user,
|
||||||
|
new_role_line_values_by_user
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
This method creates user role line history objects based on given
|
||||||
|
old/new values.
|
||||||
|
old_role_line_values_by_user and new_role_line_values_by_user are like:
|
||||||
|
{user_id:
|
||||||
|
{role_line_id:
|
||||||
|
{role_line_values},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
role_history_line_vals_by_role_line = self._prepare_create_from_vals(
|
||||||
|
old_role_line_values_by_user, new_role_line_values_by_user
|
||||||
|
)
|
||||||
|
# Create the history lines with suspend security
|
||||||
|
# (nobody has the create right)
|
||||||
|
for role_history_vals in role_history_line_vals_by_role_line.values():
|
||||||
|
self.suspend_security().create(role_history_vals)
|
||||||
75
base_user_role_history/models/res_users.py
Normal file
75
base_user_role_history/models/res_users.py
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2019 ACSONE SA/NV
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import api, fields, models, _
|
||||||
|
|
||||||
|
|
||||||
|
class ResUsers(models.Model):
|
||||||
|
_inherit = 'res.users'
|
||||||
|
|
||||||
|
last_role_line_modification = fields.Datetime(
|
||||||
|
string="Last roles modification",
|
||||||
|
readonly=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _prepare_role_line_history_dict(self, role_line):
|
||||||
|
return {
|
||||||
|
'user_id': role_line.user_id.id,
|
||||||
|
'role_id': role_line.role_id.id,
|
||||||
|
'date_from': fields.Date.from_string(role_line.date_from),
|
||||||
|
'date_to': fields.Date.from_string(role_line.date_to),
|
||||||
|
'is_enabled': role_line.is_enabled,
|
||||||
|
}
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _get_role_line_values_by_user(self):
|
||||||
|
role_line_values_by_user = {}
|
||||||
|
for rec in self:
|
||||||
|
role_line_values_by_user.setdefault(rec, {})
|
||||||
|
for role_line in rec.role_line_ids:
|
||||||
|
role_line_values_by_user[rec][role_line.id] = \
|
||||||
|
self._prepare_role_line_history_dict(role_line)
|
||||||
|
return role_line_values_by_user
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def create(self, vals):
|
||||||
|
res = super(ResUsers, self).create(vals)
|
||||||
|
if 'role_line_ids' not in vals:
|
||||||
|
return res
|
||||||
|
new_role_line_values_by_user = res._get_role_line_values_by_user()
|
||||||
|
self.env['base.user.role.line.history'].create_from_vals(
|
||||||
|
{},
|
||||||
|
new_role_line_values_by_user
|
||||||
|
)
|
||||||
|
res.last_role_line_modification = fields.Datetime.now()
|
||||||
|
return res
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def write(self, vals):
|
||||||
|
if 'role_line_ids' not in vals:
|
||||||
|
return super(ResUsers, self).write(vals)
|
||||||
|
old_role_line_values_by_user = self._get_role_line_values_by_user()
|
||||||
|
res = super(ResUsers, self).write(vals)
|
||||||
|
new_role_line_values_by_user = self._get_role_line_values_by_user()
|
||||||
|
self.env['base.user.role.line.history'].create_from_vals(
|
||||||
|
old_role_line_values_by_user,
|
||||||
|
new_role_line_values_by_user
|
||||||
|
)
|
||||||
|
self.write({
|
||||||
|
'last_role_line_modification': fields.Datetime.now()
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def show_role_lines_history(self): # pragma: no cover
|
||||||
|
self.ensure_one()
|
||||||
|
domain = [('user_id', '=', self.id)]
|
||||||
|
return {
|
||||||
|
'name': _("Roles history"),
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'view_mode': 'tree,form',
|
||||||
|
'res_model': 'base.user.role.line.history',
|
||||||
|
'domain': domain,
|
||||||
|
}
|
||||||
2
base_user_role_history/readme/CONTRIBUTORS.rst
Normal file
2
base_user_role_history/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
* Benoit Aimont <benoit.aimont@acsone.eu> (https://acsone.eu)
|
||||||
|
* Thomas Binsfeld <thomas.binsfeld@acsone.eu> (https://acsone.eu)
|
||||||
4
base_user_role_history/readme/DESCRIPTION.rst
Normal file
4
base_user_role_history/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
This addon provides history for roles modifications on users.
|
||||||
|
Each time a role is added/updated/unlinked on a user, a new role history line
|
||||||
|
is created mentioning what changes were made and who made them.
|
||||||
|
Theses informations are directly accessible from users via a smart button.
|
||||||
3
base_user_role_history/readme/ROADMAP.rst
Normal file
3
base_user_role_history/readme/ROADMAP.rst
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Since roles on role history line have 'cascade' ondelete, role deletion leads
|
||||||
|
to role history line deletion. In order to keep history even in the case of
|
||||||
|
a role deletion, module could be upgraded.
|
||||||
1
base_user_role_history/readme/USAGE.rst
Normal file
1
base_user_role_history/readme/USAGE.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Changes on user roles are easily accessible via a button on user form view.
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright 2019 ACSONE SA/NV
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
|
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record model="ir.model.access" id="base_user_role_line_history_access_name">
|
||||||
|
<field name="name">base.user.role.line.history access user</field>
|
||||||
|
<field name="model_id" ref="model_base_user_role_line_history"/>
|
||||||
|
<field name="group_id" ref="base.group_user"/>
|
||||||
|
<field name="perm_read" eval="1"/>
|
||||||
|
<field name="perm_create" eval="0"/>
|
||||||
|
<field name="perm_write" eval="0"/>
|
||||||
|
<field name="perm_unlink" eval="0"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
437
base_user_role_history/static/description/index.html
Normal file
437
base_user_role_history/static/description/index.html
Normal file
@@ -0,0 +1,437 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||||
|
<title>Base User Role History</title>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
/*
|
||||||
|
:Author: David Goodger (goodger@python.org)
|
||||||
|
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
|
||||||
|
:Copyright: This stylesheet has been placed in the public domain.
|
||||||
|
|
||||||
|
Default cascading style sheet for the HTML output of Docutils.
|
||||||
|
|
||||||
|
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||||
|
customize this style sheet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* used to remove borders from tables and images */
|
||||||
|
.borderless, table.borderless td, table.borderless th {
|
||||||
|
border: 0 }
|
||||||
|
|
||||||
|
table.borderless td, table.borderless th {
|
||||||
|
/* Override padding for "table.docutils td" with "! important".
|
||||||
|
The right padding separates the table cells. */
|
||||||
|
padding: 0 0.5em 0 0 ! important }
|
||||||
|
|
||||||
|
.first {
|
||||||
|
/* Override more specific margin styles with "! important". */
|
||||||
|
margin-top: 0 ! important }
|
||||||
|
|
||||||
|
.last, .with-subtitle {
|
||||||
|
margin-bottom: 0 ! important }
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none }
|
||||||
|
|
||||||
|
.subscript {
|
||||||
|
vertical-align: sub;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
.superscript {
|
||||||
|
vertical-align: super;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
a.toc-backref {
|
||||||
|
text-decoration: none ;
|
||||||
|
color: black }
|
||||||
|
|
||||||
|
blockquote.epigraph {
|
||||||
|
margin: 2em 5em ; }
|
||||||
|
|
||||||
|
dl.docutils dd {
|
||||||
|
margin-bottom: 0.5em }
|
||||||
|
|
||||||
|
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||||
|
dl.docutils dt {
|
||||||
|
font-weight: bold }
|
||||||
|
*/
|
||||||
|
|
||||||
|
div.abstract {
|
||||||
|
margin: 2em 5em }
|
||||||
|
|
||||||
|
div.abstract p.topic-title {
|
||||||
|
font-weight: bold ;
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||||
|
div.hint, div.important, div.note, div.tip, div.warning {
|
||||||
|
margin: 2em ;
|
||||||
|
border: medium outset ;
|
||||||
|
padding: 1em }
|
||||||
|
|
||||||
|
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||||
|
div.important p.admonition-title, div.note p.admonition-title,
|
||||||
|
div.tip p.admonition-title {
|
||||||
|
font-weight: bold ;
|
||||||
|
font-family: sans-serif }
|
||||||
|
|
||||||
|
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||||
|
div.danger p.admonition-title, div.error p.admonition-title,
|
||||||
|
div.warning p.admonition-title, .code .error {
|
||||||
|
color: red ;
|
||||||
|
font-weight: bold ;
|
||||||
|
font-family: sans-serif }
|
||||||
|
|
||||||
|
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||||
|
compound paragraphs.
|
||||||
|
div.compound .compound-first, div.compound .compound-middle {
|
||||||
|
margin-bottom: 0.5em }
|
||||||
|
|
||||||
|
div.compound .compound-last, div.compound .compound-middle {
|
||||||
|
margin-top: 0.5em }
|
||||||
|
*/
|
||||||
|
|
||||||
|
div.dedication {
|
||||||
|
margin: 2em 5em ;
|
||||||
|
text-align: center ;
|
||||||
|
font-style: italic }
|
||||||
|
|
||||||
|
div.dedication p.topic-title {
|
||||||
|
font-weight: bold ;
|
||||||
|
font-style: normal }
|
||||||
|
|
||||||
|
div.figure {
|
||||||
|
margin-left: 2em ;
|
||||||
|
margin-right: 2em }
|
||||||
|
|
||||||
|
div.footer, div.header {
|
||||||
|
clear: both;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
div.line-block {
|
||||||
|
display: block ;
|
||||||
|
margin-top: 1em ;
|
||||||
|
margin-bottom: 1em }
|
||||||
|
|
||||||
|
div.line-block div.line-block {
|
||||||
|
margin-top: 0 ;
|
||||||
|
margin-bottom: 0 ;
|
||||||
|
margin-left: 1.5em }
|
||||||
|
|
||||||
|
div.sidebar {
|
||||||
|
margin: 0 0 0.5em 1em ;
|
||||||
|
border: medium outset ;
|
||||||
|
padding: 1em ;
|
||||||
|
background-color: #ffffee ;
|
||||||
|
width: 40% ;
|
||||||
|
float: right ;
|
||||||
|
clear: right }
|
||||||
|
|
||||||
|
div.sidebar p.rubric {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-size: medium }
|
||||||
|
|
||||||
|
div.system-messages {
|
||||||
|
margin: 5em }
|
||||||
|
|
||||||
|
div.system-messages h1 {
|
||||||
|
color: red }
|
||||||
|
|
||||||
|
div.system-message {
|
||||||
|
border: medium outset ;
|
||||||
|
padding: 1em }
|
||||||
|
|
||||||
|
div.system-message p.system-message-title {
|
||||||
|
color: red ;
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
div.topic {
|
||||||
|
margin: 2em }
|
||||||
|
|
||||||
|
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||||
|
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||||
|
margin-top: 0.4em }
|
||||||
|
|
||||||
|
h1.title {
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
h2.subtitle {
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
hr.docutils {
|
||||||
|
width: 75% }
|
||||||
|
|
||||||
|
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||||
|
clear: left ;
|
||||||
|
float: left ;
|
||||||
|
margin-right: 1em }
|
||||||
|
|
||||||
|
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||||
|
clear: right ;
|
||||||
|
float: right ;
|
||||||
|
margin-left: 1em }
|
||||||
|
|
||||||
|
img.align-center, .figure.align-center, object.align-center {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.align-center {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-left {
|
||||||
|
text-align: left }
|
||||||
|
|
||||||
|
.align-center {
|
||||||
|
clear: both ;
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
.align-right {
|
||||||
|
text-align: right }
|
||||||
|
|
||||||
|
/* reset inner alignment in figures */
|
||||||
|
div.align-right {
|
||||||
|
text-align: inherit }
|
||||||
|
|
||||||
|
/* div.align-center * { */
|
||||||
|
/* text-align: left } */
|
||||||
|
|
||||||
|
.align-top {
|
||||||
|
vertical-align: top }
|
||||||
|
|
||||||
|
.align-middle {
|
||||||
|
vertical-align: middle }
|
||||||
|
|
||||||
|
.align-bottom {
|
||||||
|
vertical-align: bottom }
|
||||||
|
|
||||||
|
ol.simple, ul.simple {
|
||||||
|
margin-bottom: 1em }
|
||||||
|
|
||||||
|
ol.arabic {
|
||||||
|
list-style: decimal }
|
||||||
|
|
||||||
|
ol.loweralpha {
|
||||||
|
list-style: lower-alpha }
|
||||||
|
|
||||||
|
ol.upperalpha {
|
||||||
|
list-style: upper-alpha }
|
||||||
|
|
||||||
|
ol.lowerroman {
|
||||||
|
list-style: lower-roman }
|
||||||
|
|
||||||
|
ol.upperroman {
|
||||||
|
list-style: upper-roman }
|
||||||
|
|
||||||
|
p.attribution {
|
||||||
|
text-align: right ;
|
||||||
|
margin-left: 50% }
|
||||||
|
|
||||||
|
p.caption {
|
||||||
|
font-style: italic }
|
||||||
|
|
||||||
|
p.credits {
|
||||||
|
font-style: italic ;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
p.label {
|
||||||
|
white-space: nowrap }
|
||||||
|
|
||||||
|
p.rubric {
|
||||||
|
font-weight: bold ;
|
||||||
|
font-size: larger ;
|
||||||
|
color: maroon ;
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
p.sidebar-title {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-weight: bold ;
|
||||||
|
font-size: larger }
|
||||||
|
|
||||||
|
p.sidebar-subtitle {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
p.topic-title {
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
pre.address {
|
||||||
|
margin-bottom: 0 ;
|
||||||
|
margin-top: 0 ;
|
||||||
|
font: inherit }
|
||||||
|
|
||||||
|
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||||
|
margin-left: 2em ;
|
||||||
|
margin-right: 2em }
|
||||||
|
|
||||||
|
pre.code .ln { color: grey; } /* line numbers */
|
||||||
|
pre.code, code { background-color: #eeeeee }
|
||||||
|
pre.code .comment, code .comment { color: #5C6576 }
|
||||||
|
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||||
|
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||||
|
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||||
|
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||||
|
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||||
|
|
||||||
|
span.classifier {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-style: oblique }
|
||||||
|
|
||||||
|
span.classifier-delimiter {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
span.interpreted {
|
||||||
|
font-family: sans-serif }
|
||||||
|
|
||||||
|
span.option {
|
||||||
|
white-space: nowrap }
|
||||||
|
|
||||||
|
span.pre {
|
||||||
|
white-space: pre }
|
||||||
|
|
||||||
|
span.problematic {
|
||||||
|
color: red }
|
||||||
|
|
||||||
|
span.section-subtitle {
|
||||||
|
/* font-size relative to parent (h1..h6 element) */
|
||||||
|
font-size: 80% }
|
||||||
|
|
||||||
|
table.citation {
|
||||||
|
border-left: solid 1px gray;
|
||||||
|
margin-left: 1px }
|
||||||
|
|
||||||
|
table.docinfo {
|
||||||
|
margin: 2em 4em }
|
||||||
|
|
||||||
|
table.docutils {
|
||||||
|
margin-top: 0.5em ;
|
||||||
|
margin-bottom: 0.5em }
|
||||||
|
|
||||||
|
table.footnote {
|
||||||
|
border-left: solid 1px black;
|
||||||
|
margin-left: 1px }
|
||||||
|
|
||||||
|
table.docutils td, table.docutils th,
|
||||||
|
table.docinfo td, table.docinfo th {
|
||||||
|
padding-left: 0.5em ;
|
||||||
|
padding-right: 0.5em ;
|
||||||
|
vertical-align: top }
|
||||||
|
|
||||||
|
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||||
|
font-weight: bold ;
|
||||||
|
text-align: left ;
|
||||||
|
white-space: nowrap ;
|
||||||
|
padding-left: 0 }
|
||||||
|
|
||||||
|
/* "booktabs" style (no vertical lines) */
|
||||||
|
table.docutils.booktabs {
|
||||||
|
border: 0px;
|
||||||
|
border-top: 2px solid;
|
||||||
|
border-bottom: 2px solid;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
table.docutils.booktabs * {
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
table.docutils.booktabs th {
|
||||||
|
border-bottom: thin solid;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||||
|
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||||
|
font-size: 100% }
|
||||||
|
|
||||||
|
ul.auto-toc {
|
||||||
|
list-style-type: none }
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="document" id="base-user-role-history">
|
||||||
|
<h1 class="title">Base User Role History</h1>
|
||||||
|
|
||||||
|
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
|
!! changes will be overwritten. !!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
|
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-tools/tree/9.0/base_user_role_history"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-tools-9-0/server-tools-9-0-base_user_role_history"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/149/9.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
|
<p>This addon provides history for roles modifications on users.
|
||||||
|
Each time a role is added/updated/unlinked on a user, a new role history line
|
||||||
|
is created mentioning what changes were made and who made them.
|
||||||
|
Theses informations are directly accessible from users via a smart button.</p>
|
||||||
|
<p><strong>Table of contents</strong></p>
|
||||||
|
<div class="contents local topic" id="contents">
|
||||||
|
<ul class="simple">
|
||||||
|
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
|
||||||
|
<li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li>
|
||||||
|
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
|
||||||
|
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
|
||||||
|
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
|
||||||
|
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
|
||||||
|
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="usage">
|
||||||
|
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
|
||||||
|
<p>Changes on user roles are easily accessible via a button on user form view.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="known-issues-roadmap">
|
||||||
|
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
|
||||||
|
<p>Since roles on role history line have ‘cascade’ ondelete, role deletion leads
|
||||||
|
to role history line deletion. In order to keep history even in the case of
|
||||||
|
a role deletion, module could be upgraded.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="bug-tracker">
|
||||||
|
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
|
||||||
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
|
||||||
|
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
|
||||||
|
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_user_role_history%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="credits">
|
||||||
|
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
|
||||||
|
<div class="section" id="authors">
|
||||||
|
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>ACSONE SA/NV</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="contributors">
|
||||||
|
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Benoit Aimont <<a class="reference external" href="mailto:benoit.aimont@acsone.eu">benoit.aimont@acsone.eu</a>> (<a class="reference external" href="https://acsone.eu">https://acsone.eu</a>)</li>
|
||||||
|
<li>Thomas Binsfeld <<a class="reference external" href="mailto:thomas.binsfeld@acsone.eu">thomas.binsfeld@acsone.eu</a>> (<a class="reference external" href="https://acsone.eu">https://acsone.eu</a>)</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="maintainers">
|
||||||
|
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
|
||||||
|
<p>This module is maintained by the OCA.</p>
|
||||||
|
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||||
|
<p>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.</p>
|
||||||
|
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||||
|
<p><a class="reference external" href="https://github.com/ThomasBinsfeld"><img alt="ThomasBinsfeld" src="https://github.com/ThomasBinsfeld.png?size=40px" /></a></p>
|
||||||
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/9.0/base_user_role_history">OCA/server-tools</a> project on GitHub.</p>
|
||||||
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
base_user_role_history/tests/__init__.py
Normal file
1
base_user_role_history/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import test_base_user_role_history
|
||||||
160
base_user_role_history/tests/test_base_user_role_history.py
Normal file
160
base_user_role_history/tests/test_base_user_role_history.py
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2019 ACSONE SA/NV
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).µ
|
||||||
|
|
||||||
|
from datetime import date, timedelta
|
||||||
|
|
||||||
|
from openerp import fields
|
||||||
|
from openerp.tests.common import SavepointCase
|
||||||
|
|
||||||
|
|
||||||
|
class TestBaseUserRoleHistory(SavepointCase):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super(TestBaseUserRoleHistory, cls).setUpClass()
|
||||||
|
|
||||||
|
# MODELS
|
||||||
|
|
||||||
|
cls.history_line_model = cls.env['base.user.role.line.history']
|
||||||
|
cls.role_model = cls.env['res.users.role']
|
||||||
|
cls.user_model = cls.env['res.users']
|
||||||
|
|
||||||
|
# INSTANCE
|
||||||
|
|
||||||
|
cls.user_01 = cls.user_model.search([
|
||||||
|
('id', '!=', cls.env.user.id)
|
||||||
|
], limit=1)
|
||||||
|
cls.role_01 = cls.role_model.create({
|
||||||
|
'name': "Role test 01",
|
||||||
|
})
|
||||||
|
|
||||||
|
def test_write_role_lines_on_user(self):
|
||||||
|
"""
|
||||||
|
Data :
|
||||||
|
- user with no role
|
||||||
|
Test case :
|
||||||
|
1) add a role
|
||||||
|
2) role modification with dates
|
||||||
|
3) role modification with no change
|
||||||
|
4) role unlink
|
||||||
|
Expected results :
|
||||||
|
1) new role history line created with performed_action == 'add'
|
||||||
|
2) new role history line created with performed_action == 'edit'
|
||||||
|
3) no new role history line created
|
||||||
|
4) new role history line created with performed_action == 'unlink'
|
||||||
|
"""
|
||||||
|
# 1
|
||||||
|
history_lines_0 = self.history_line_model.search([
|
||||||
|
('user_id', '=', self.user_01.id)
|
||||||
|
])
|
||||||
|
self.assertFalse(history_lines_0)
|
||||||
|
self.user_01.write({
|
||||||
|
'role_line_ids': [
|
||||||
|
(0, 0, {
|
||||||
|
'role_id': self.role_01.id
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
history_lines_1 = self.history_line_model.search([
|
||||||
|
('user_id', '=', self.user_01.id)
|
||||||
|
])
|
||||||
|
self.assertTrue(history_lines_1)
|
||||||
|
self.assertEqual(len(history_lines_1), 1)
|
||||||
|
self.assertEqual(history_lines_1.performed_action, 'add')
|
||||||
|
self.assertFalse(history_lines_1.old_role_id)
|
||||||
|
self.assertEqual(history_lines_1.new_role_id, self.role_01)
|
||||||
|
# 2
|
||||||
|
self.user_01.write({
|
||||||
|
'role_line_ids': [
|
||||||
|
(1, self.user_01.role_line_ids[0].id, {
|
||||||
|
'date_from': date.today(),
|
||||||
|
'date_to': date.today() + timedelta(days=5),
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
history_lines_2 = self.history_line_model.search([
|
||||||
|
('user_id', '=', self.user_01.id),
|
||||||
|
('id', 'not in', history_lines_1.ids)
|
||||||
|
])
|
||||||
|
self.assertTrue(history_lines_2)
|
||||||
|
self.assertEqual(len(history_lines_2), 1)
|
||||||
|
self.assertEqual(history_lines_2.performed_action, 'edit')
|
||||||
|
self.assertEqual(history_lines_2.old_role_id, self.role_01)
|
||||||
|
self.assertEqual(history_lines_2.new_role_id, self.role_01)
|
||||||
|
self.assertFalse(history_lines_2.old_date_from)
|
||||||
|
self.assertEqual(history_lines_2.new_date_from,
|
||||||
|
fields.Date.to_string(date.today()))
|
||||||
|
self.assertFalse(history_lines_2.old_date_to)
|
||||||
|
self.assertEqual(history_lines_2.new_date_to,
|
||||||
|
fields.Date.to_string(
|
||||||
|
date.today() + timedelta(days=5)))
|
||||||
|
self.user_01.write({
|
||||||
|
'role_line_ids': [(1, self.user_01.role_line_ids[0].id, {})]
|
||||||
|
})
|
||||||
|
history_lines_3 = self.history_line_model.search([
|
||||||
|
('user_id', '=', self.user_01.id),
|
||||||
|
('id', 'not in', (history_lines_1 | history_lines_2).ids)
|
||||||
|
])
|
||||||
|
self.assertFalse(history_lines_3)
|
||||||
|
# 4
|
||||||
|
self.user_01.write({
|
||||||
|
'role_line_ids': [(2, self.user_01.role_line_ids[0].id, False)],
|
||||||
|
})
|
||||||
|
history_lines_4 = self.history_line_model.search([
|
||||||
|
('user_id', '=', self.user_01.id),
|
||||||
|
('id', 'not in', (history_lines_1 | history_lines_2).ids)
|
||||||
|
])
|
||||||
|
self.assertTrue(history_lines_4)
|
||||||
|
self.assertEqual(len(history_lines_4), 1)
|
||||||
|
self.assertEqual(history_lines_4.performed_action, 'unlink')
|
||||||
|
self.assertEqual(history_lines_4.old_role_id, self.role_01)
|
||||||
|
self.assertFalse(history_lines_4.new_role_id)
|
||||||
|
self.assertEqual(history_lines_4.old_date_from,
|
||||||
|
fields.Date.to_string(date.today()))
|
||||||
|
self.assertFalse(history_lines_4.new_date_from)
|
||||||
|
self.assertEqual(history_lines_4.old_date_to,
|
||||||
|
fields.Date.to_string(
|
||||||
|
date.today() + timedelta(days=5)))
|
||||||
|
self.assertFalse(history_lines_4.new_date_to)
|
||||||
|
|
||||||
|
def test_create_role_lines_on_new_user(self):
|
||||||
|
"""
|
||||||
|
Data : /
|
||||||
|
Test case :
|
||||||
|
- create a user with a role
|
||||||
|
Expected results :
|
||||||
|
- new role history line created with performed_action == 'add'
|
||||||
|
"""
|
||||||
|
new_user = self.user_model.create({
|
||||||
|
'login': 'new_user',
|
||||||
|
'name': 'new_user',
|
||||||
|
'role_line_ids': [
|
||||||
|
(0, 0, {
|
||||||
|
'role_id': self.role_01.id,
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
history_lines = self.history_line_model.search([
|
||||||
|
('user_id', '=', new_user.id)
|
||||||
|
])
|
||||||
|
self.assertTrue(history_lines)
|
||||||
|
self.assertEqual(len(history_lines), 1)
|
||||||
|
self.assertEqual(history_lines.performed_action, 'add')
|
||||||
|
|
||||||
|
def test_no_create_role_lines_on_new_user(self):
|
||||||
|
"""
|
||||||
|
Data : /
|
||||||
|
Test case :
|
||||||
|
- create a user without role
|
||||||
|
Expected results :
|
||||||
|
- no role history line created
|
||||||
|
"""
|
||||||
|
new_user = self.user_model.create({
|
||||||
|
'login': 'new_user',
|
||||||
|
'name': 'new_user',
|
||||||
|
})
|
||||||
|
history_lines = self.history_line_model.search([
|
||||||
|
('user_id', '=', new_user.id)
|
||||||
|
])
|
||||||
|
self.assertFalse(history_lines)
|
||||||
89
base_user_role_history/views/base_user_role_line_history.xml
Normal file
89
base_user_role_history/views/base_user_role_line_history.xml
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright 2019 ACSONE SA/NV
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
|
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<!--FORM view-->
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="base_user_role_line_history_form_view">
|
||||||
|
<field name="name">base.user.role.line.history.form (in base_user_role_history)</field>
|
||||||
|
<field name="model">base.user.role.line.history</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form create="0" edit="0" delete="0">
|
||||||
|
<header>
|
||||||
|
</header>
|
||||||
|
<sheet>
|
||||||
|
<group name="group_main" col="4">
|
||||||
|
<field name="create_uid"
|
||||||
|
string="Editor"/>
|
||||||
|
<field name="performed_action"/>
|
||||||
|
<field name="user_id"
|
||||||
|
string="Edited user"/>
|
||||||
|
<field name="create_date"
|
||||||
|
string="Date and time of edition"/>
|
||||||
|
<field name="old_role_id"/>
|
||||||
|
<field name="new_role_id"/>
|
||||||
|
<field name="old_date_from"/>
|
||||||
|
<field name="new_date_from"/>
|
||||||
|
<field name="old_date_to"/>
|
||||||
|
<field name="new_date_to"/>
|
||||||
|
<field name="old_is_enabled"/>
|
||||||
|
<field name="new_is_enabled"/>
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!--TREE view-->
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="base_user_role_line_history_tree_view">
|
||||||
|
<field name="name">base.user.role.line.history.tree (in base_user_role_history)</field>
|
||||||
|
<field name="model">base.user.role.line.history</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree decoration-success="performed_action == 'add'"
|
||||||
|
decoration-danger="performed_action == 'unlink'"
|
||||||
|
create="0" edit="0" delete="0">
|
||||||
|
<field name="create_uid"
|
||||||
|
string="Editor"/>
|
||||||
|
<field name="create_date"
|
||||||
|
string="Date and time of edition"/>
|
||||||
|
<field name="performed_action"/>
|
||||||
|
<field name="old_role_id"/>
|
||||||
|
<field name="new_role_id"/>
|
||||||
|
<field name="old_date_from"/>
|
||||||
|
<field name="new_date_from"/>
|
||||||
|
<field name="old_date_to"/>
|
||||||
|
<field name="new_date_to"/>
|
||||||
|
<field name="old_is_enabled"/>
|
||||||
|
<field name="new_is_enabled"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!--SEARCH view-->
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="base_user_role_line_history_search_view">
|
||||||
|
<field name="name">base.user.role.line.history.search (in base_user_role_history)</field>
|
||||||
|
<field name="model">base.user.role.line.history</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search>
|
||||||
|
<field name="old_role_id"/>
|
||||||
|
<field name="new_role_id"/>
|
||||||
|
<group string="Group By" name="groupby">
|
||||||
|
<filter name="group_by_old_role"
|
||||||
|
string="Old role"
|
||||||
|
context="{'group_by': 'old_role_id'}"/>
|
||||||
|
<filter name="group_by_new_role"
|
||||||
|
string="New role"
|
||||||
|
context="{'group_by': 'new_role_id'}"/>
|
||||||
|
<filter name="group_by_performed_action"
|
||||||
|
string="Action"
|
||||||
|
context="{'group_by': 'performed_action'}"/>
|
||||||
|
</group>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
29
base_user_role_history/views/res_users.xml
Normal file
29
base_user_role_history/views/res_users.xml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright 2019 ACSONE SA/NV
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
|
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<!--FORM view-->
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="res_users_form_view">
|
||||||
|
<field name="name">res.users.form (in base_user_role_history)</field>
|
||||||
|
<field name="model">res.users</field>
|
||||||
|
<field name="inherit_id" ref="base.view_users_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<div name="button_box" position="inside">
|
||||||
|
<button name="show_role_lines_history"
|
||||||
|
help="Roles history"
|
||||||
|
class="oe_stat_button"
|
||||||
|
icon="fa-history"
|
||||||
|
type="object">
|
||||||
|
<div class="o_stat_info">
|
||||||
|
<span class="o_stat_text">Last update of roles</span>
|
||||||
|
<field class="o_stat_value" name="last_role_line_modification"/>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user