Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2abe8ae
Module 'auditlog' - Log HTTP user sessions and requests
sebalix Oct 30, 2015
cd36194
Module 'auditlog' - Bump the version to 1.1.0
sebalix Oct 30, 2015
9035a20
Module 'auditlog' - Cleanup XML views (types removed)
sebalix Oct 30, 2015
d392c20
Module 'auditlog' - A log can be created with no current HTTP request…
sebalix Oct 30, 2015
54edaaf
Module 'auditlog' - 'display_name' fields added for the user session …
sebalix Oct 31, 2015
0e876f9
Module 'auditlog' - Fix pylint check
sebalix Oct 31, 2015
44089f9
turn off prefetching when reding values
hbrunn Nov 26, 2015
b57bbde
auditlog - Ability to choose the log type on the rule: Full log (comp…
sebalix Feb 1, 2016
a95baa2
auditlog - Field 'type' renamed to 'log_type'
sebalix Feb 13, 2016
ffef454
auditlog - Bump version number
sebalix Feb 13, 2016
f43da33
auditlog - Auto-vacuum logs, HTTP requests and HTTP user sessions
sebalix Feb 13, 2016
f3edd5c
auditlog - Icon added + README updated (screenshots)
sebalix May 26, 2016
a993256
singleton error if we saved the current session two times (#473)
hbrunn Jul 4, 2016
379dfc7
OCA Transbot updated translations from Transifex
oca-transbot Oct 26, 2015
542dab0
Migrate auditlog module from 8.0 to 9.0
holdenrehg Jun 6, 2016
16d0183
Updated the __openerp__.xml to include the license and images fields
holdenrehg Jun 13, 2016
5e3d308
auditlog module, Remove duplicate license key from openerp config
holdenrehg Jun 24, 2016
c570e70
auditlog: Remove migration from audittrail functionality, this is not…
holdenrehg Jun 27, 2016
6abb429
auditlog: Remove pre_init_hook reference from openerp, no pre_init ho…
holdenrehg Jun 27, 2016
ef22ab2
auditlog - Lint
sebalix Nov 14, 2016
2be8bdd
auditlog - Migrate 'AuditlogRule.create' and 'AuditlogRule.write' met…
sebalix Nov 14, 2016
df93a96
OCA Transbot updated translations from Transifex
oca-transbot Nov 29, 2016
7b8bd4d
[MIG] auditlog: Migrated to 10.0
Jan 20, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions auditlog/README.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
Track user operation on data models
===================================
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=================================
Audit Log - Track user operations
=================================

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

Usage
=====

Go to `Reporting / Audit / Rules` to subscribe rules. A rule defines which
operations to log for a given data model.
Then, check logs in the `Reporting / Audit / Logs` menu.
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

During installation, it will migrate any existing data from the `audittrail`
module (rules and logs).
Get the details:

For further information, please visit:
.. image:: /auditlog/static/description/log.png

* https://www.odoo.com/forum/help-1
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

Known issues / Roadmap
======================

* log only operations triggered by some users (currently it logs all users)
* group logs by HTTP query (thanks to werzeug)?
* group HTTP query by user session?


Bug Tracker
Expand All @@ -43,6 +57,12 @@ Contributors

* Sebastien Alix <sebastien.alix@osiell.com>
* Holger Brunn <hbrunn@therp.nl>
* Holden Rehg <holdenrehg@gmail.com>

Images
------

* Icon: built with different icons from the `Oxygen theme <https://en.wikipedia.org/wiki/Oxygen_Project>`_ (LGPL)

Maintainer
----------
Expand Down
43 changes: 2 additions & 41 deletions auditlog/__init__.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 ABF OSIELL (<http://osiell.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models


def pre_init_hook(cr):
cr.execute("SELECT 1 FROM pg_class WHERE relname = 'audittrail_rule'")
if cr.fetchall():
migrate_from_audittrail(cr)


def migrate_from_audittrail(cr):
cr.execute('ALTER TABLE audittrail_rule RENAME TO auditlog_rule')
cr.execute('ALTER TABLE audittrail_rule_id_seq '
'RENAME TO auditlog_rule_id_seq')
cr.execute('ALTER TABLE auditlog_rule RENAME COLUMN object_id TO model_id')
cr.execute('ALTER TABLE audittrail_log RENAME TO auditlog_log')
cr.execute('ALTER TABLE audittrail_log_id_seq '
'RENAME TO auditlog_log_id_seq')
cr.execute('ALTER TABLE auditlog_log RENAME COLUMN object_id TO model_id')
cr.execute('ALTER TABLE audittrail_log_line RENAME TO auditlog_log_line')
cr.execute('ALTER TABLE audittrail_log_line_id_seq '
'RENAME TO auditlog_log_line_id_seq')
cr.execute("UPDATE ir_model_data SET model='auditlog.rule' "
"WHERE model='audittrail.rule'")
30 changes: 8 additions & 22 deletions auditlog/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 ABF OSIELL (<http://osiell.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': "Audit Log",
'version': "8.0.1.0.0",
'version': "10.0.1.0.0",
'author': "ABF OSIELL,Odoo Community Association (OCA)",
'license': "AGPL-3",
'website': "http://www.osiell.com",
'category': "Tools",
'depends': [
'base',
],
'data': [
'security/ir.model.access.csv',
'data/ir_cron.xml',
'views/auditlog_view.xml',
'views/http_session_view.xml',
'views/http_request_view.xml',
],
'application': True,
'installable': False,
'pre_init_hook': 'pre_init_hook',
'installable': True,
}
16 changes: 16 additions & 0 deletions auditlog/data/ir_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">

<record id="ir_cron_auditlog_autovacuum" model="ir.cron">
<field name='name'>Auto-vacuum audit logs</field>
<field name='interval_number'>1</field>
<field name='interval_type'>days</field>
<field name="numbercall">-1</field>
<field name="active" eval="False"/>
<field name="doall" eval="False"/>
<field name="model">auditlog.autovacuum</field>
<field name="function">autovacuum</field>
<field name="args">(180,)</field>
</record>

</odoo>
Loading