diff --git a/auditlog/README.rst b/auditlog/README.rst index 2cc5c87c8..3fda82516 100644 --- a/auditlog/README.rst +++ b/auditlog/README.rst @@ -1,14 +1,38 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 +========= +Audit Log +========= -================================= -Audit Log - Track user operations -================================= +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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/12.0/auditlog + :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-12-0/server-tools-12-0-auditlog + :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/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| This module allows the administrator to log user operations performed on data models such as ``create``, ``read``, ``write`` and ``delete``. +**Table of contents** + +.. contents:: + :local: + Usage ===== @@ -38,41 +62,51 @@ Known issues / Roadmap ====================== * log only operations triggered by some users (currently it logs all users) - + * log read operations does not work on all data models, need investigation Bug Tracker =========== Bugs are tracked on `GitHub 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 -`here `_. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. +Do not contact contributors directly about support or help with technical issues. Credits ======= -Contributors ------------- +Authors +~~~~~~~ -* Sebastien Alix +* ABF OSIELL + +Contributors +~~~~~~~~~~~~ + +* Sebastien Alix * Holger Brunn * Holden Rehg -Images ------- +Other credits +~~~~~~~~~~~~~ * Icon: built with different icons from the `Oxygen theme `_ (LGPL) -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. +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. -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. +This module is part of the `OCA/server-tools `_ project on GitHub. -To contribute to this module, please visit https://odoo-community.org. +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/auditlog/__manifest__.py b/auditlog/__manifest__.py index ba35fb506..fe357ebce 100644 --- a/auditlog/__manifest__.py +++ b/auditlog/__manifest__.py @@ -1,12 +1,12 @@ -# © 2015 ABF OSIELL +# Copyright 2015 ABF OSIELL # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { 'name': "Audit Log", - 'version': "11.0.1.0.0", + 'version': "12.0.1.0.0", 'author': "ABF OSIELL,Odoo Community Association (OCA)", 'license': "AGPL-3", - 'website': "https://www.osiell.com", + 'website': "https://github.com/OCA/server-tools/", 'category': "Tools", 'depends': [ 'base', diff --git a/auditlog/models/autovacuum.py b/auditlog/models/autovacuum.py index 17505d9fd..b3770ed63 100644 --- a/auditlog/models/autovacuum.py +++ b/auditlog/models/autovacuum.py @@ -1,4 +1,4 @@ -# © 2016 ABF OSIELL +# Copyright 2016 ABF OSIELL # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging from datetime import datetime, timedelta diff --git a/auditlog/models/http_request.py b/auditlog/models/http_request.py index 04ade415e..a1cb5ac40 100644 --- a/auditlog/models/http_request.py +++ b/auditlog/models/http_request.py @@ -1,4 +1,4 @@ -# © 2015 ABF OSIELL +# Copyright 2015 ABF OSIELL # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from psycopg2.extensions import AsIs diff --git a/auditlog/models/http_session.py b/auditlog/models/http_session.py index daccc395e..85e9963e9 100644 --- a/auditlog/models/http_session.py +++ b/auditlog/models/http_session.py @@ -1,4 +1,4 @@ -# © 2015 ABF OSIELL +# Copyright 2015 ABF OSIELL # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import models, fields, api diff --git a/auditlog/models/log.py b/auditlog/models/log.py index 25b5a02b0..bbab1fc92 100644 --- a/auditlog/models/log.py +++ b/auditlog/models/log.py @@ -1,4 +1,4 @@ -# © 2015 ABF OSIELL +# Copyright 2015 ABF OSIELL # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import models, fields diff --git a/auditlog/models/rule.py b/auditlog/models/rule.py index 006c9e770..c4d061cd4 100644 --- a/auditlog/models/rule.py +++ b/auditlog/models/rule.py @@ -1,4 +1,4 @@ -# © 2015 ABF OSIELL +# Copyright 2015 ABF OSIELL # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import models, fields, api, modules, _ @@ -44,32 +44,40 @@ class AuditlogRule(models.Model): _name = 'auditlog.rule' _description = "Auditlog - Rule" - name = fields.Char("Name", size=32, required=True) + name = fields.Char( + "Name", required=True, + states={'subscribed': [('readonly', True)]}) model_id = fields.Many2one( 'ir.model', "Model", required=True, - help="Select model for which you want to generate log.") + help="Select model for which you want to generate log.", + states={'subscribed': [('readonly', True)]}) user_ids = fields.Many2many( 'res.users', 'audittail_rules_users', 'user_id', 'rule_id', string="Users", - help="if User is not added then it will applicable for all users") + help="if User is not added then it will applicable for all users", + states={'subscribed': [('readonly', True)]}) log_read = fields.Boolean( "Log Reads", help=("Select this if you want to keep track of read/open on any " - "record of the model of this rule")) + "record of the model of this rule"), + states={'subscribed': [('readonly', True)]}) log_write = fields.Boolean( "Log Writes", default=True, help=("Select this if you want to keep track of modification on any " - "record of the model of this rule")) + "record of the model of this rule"), + states={'subscribed': [('readonly', True)]}) log_unlink = fields.Boolean( "Log Deletes", default=True, help=("Select this if you want to keep track of deletion on any " - "record of the model of this rule")) + "record of the model of this rule"), + states={'subscribed': [('readonly', True)]}) log_create = fields.Boolean( "Log Creates", default=True, help=("Select this if you want to keep track of creation on any " - "record of the model of this rule")) + "record of the model of this rule"), + states={'subscribed': [('readonly', True)]}) log_type = fields.Selection( [('full', "Full log"), ('fast', "Fast log"), @@ -79,7 +87,8 @@ class AuditlogRule(models.Model): "the operation (log more info like computed fields which were " "updated, but it is slower)\n" "Fast log: only log the changes made through the create and " - "write operations (less information, but it is faster)")) + "write operations (less information, but it is faster)"), + states={'subscribed': [('readonly', True)]}) # log_action = fields.Boolean( # "Log Action", # help=("Select this if you want to keep track of actions on the " @@ -92,7 +101,8 @@ class AuditlogRule(models.Model): [('draft', "Draft"), ('subscribed', "Subscribed")], string="State", required=True, default='draft') action_id = fields.Many2one( - 'ir.actions.act_window', string="Action") + 'ir.actions.act_window', string="Action", + states={'subscribed': [('readonly', True)]}) _sql_constraints = [ ('model_uniq', 'unique(model_id)', diff --git a/auditlog/readme/CONTRIBUTORS.rst b/auditlog/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..1567f0b2c --- /dev/null +++ b/auditlog/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Sebastien Alix +* Holger Brunn +* Holden Rehg diff --git a/auditlog/readme/CREDITS.rst b/auditlog/readme/CREDITS.rst new file mode 100644 index 000000000..037907b61 --- /dev/null +++ b/auditlog/readme/CREDITS.rst @@ -0,0 +1 @@ +* Icon: built with different icons from the `Oxygen theme `_ (LGPL) diff --git a/auditlog/readme/DESCRIPTION.rst b/auditlog/readme/DESCRIPTION.rst new file mode 100644 index 000000000..97cd1bd9d --- /dev/null +++ b/auditlog/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows the administrator to log user operations performed on data +models such as ``create``, ``read``, ``write`` and ``delete``. diff --git a/auditlog/readme/ROADMAP.rst b/auditlog/readme/ROADMAP.rst new file mode 100644 index 000000000..5a8b6def3 --- /dev/null +++ b/auditlog/readme/ROADMAP.rst @@ -0,0 +1,2 @@ + * log only operations triggered by some users (currently it logs all users) + * log read operations does not work on all data models, need investigation diff --git a/auditlog/readme/USAGE.rst b/auditlog/readme/USAGE.rst new file mode 100644 index 000000000..c13f508a4 --- /dev/null +++ b/auditlog/readme/USAGE.rst @@ -0,0 +1,21 @@ +Go to `Settings / Technical / Audit / Rules` to subscribe rules. A rule defines +which operations to log for a given data model. + +.. image:: /auditlog/static/description/rule.png + +Then, check logs in the `Settings / Technical / Audit / Logs` menu. You can +group them by user sessions, date, data model or HTTP requests: + +.. image:: /auditlog/static/description/logs.png + +Get the details: + +.. image:: /auditlog/static/description/log.png + +A scheduled action exists to delete logs older than 6 months (180 days) +automatically but is not enabled by default. +To activate it and/or change the delay, go to the +`Configuration / Technical / Automation / Scheduled Actions` menu and edit the +`Auto-vacuum audit logs` entry: + +.. image:: /auditlog/static/description/autovacuum.png diff --git a/auditlog/static/description/index.html b/auditlog/static/description/index.html new file mode 100644 index 000000000..533b49ad4 --- /dev/null +++ b/auditlog/static/description/index.html @@ -0,0 +1,457 @@ + + + + + + +Audit Log + + + +
+

Audit Log

+ + +

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

This module allows the administrator to log user operations performed on data +models such as create, read, write and delete.

+

Table of contents

+ +
+

Usage

+

Go to Settings / Technical / Audit / Rules to subscribe rules. A rule defines +which operations to log for a given data model.

+/auditlog/static/description/rule.png +

Then, check logs in the Settings / Technical / Audit / Logs menu. You can +group them by user sessions, date, data model or HTTP requests:

+/auditlog/static/description/logs.png +

Get the details:

+/auditlog/static/description/log.png +

A scheduled action exists to delete logs older than 6 months (180 days) +automatically but is not enabled by default. +To activate it and/or change the delay, go to the +Configuration / Technical / Automation / Scheduled Actions menu and edit the +Auto-vacuum audit logs entry:

+/auditlog/static/description/autovacuum.png +
+
+

Known issues / Roadmap

+
+
    +
  • log only operations triggered by some users (currently it logs all users)
  • +
  • log read operations does not work on all data models, need investigation
  • +
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ABF OSIELL
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+
    +
  • Icon: built with different icons from the Oxygen theme (LGPL)
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/server-tools project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/auditlog/tests/test_auditlog.py b/auditlog/tests/test_auditlog.py index 01371192b..996cf5fa1 100644 --- a/auditlog/tests/test_auditlog.py +++ b/auditlog/tests/test_auditlog.py @@ -1,9 +1,9 @@ -# © 2015 Therp BV +# Copyright 2015 Therp BV # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo.tests.common import TransactionCase -class TestAuditlog(object): +class AuditlogCommon(object): def test_LogCreation(self): """First test, caching some data.""" @@ -81,7 +81,7 @@ class TestAuditlog(object): ]).ensure_one()) -class TestAuditlogFull(TransactionCase, TestAuditlog): +class TestAuditlogFull(TransactionCase, AuditlogCommon): def setUp(self): super(TestAuditlogFull, self).setUp() @@ -101,7 +101,7 @@ class TestAuditlogFull(TransactionCase, TestAuditlog): super(TestAuditlogFull, self).tearDown() -class TestAuditlogFast(TransactionCase, TestAuditlog): +class TestAuditlogFast(TransactionCase, AuditlogCommon): def setUp(self): super(TestAuditlogFast, self).setUp() diff --git a/auditlog/tests/test_autovacuum.py b/auditlog/tests/test_autovacuum.py index d621d3cf9..1b6fae60d 100644 --- a/auditlog/tests/test_autovacuum.py +++ b/auditlog/tests/test_autovacuum.py @@ -1,4 +1,4 @@ -# © 2016 ABF OSIELL +# Copyright 2016 ABF OSIELL # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import time