v 15.0 Third Party 3706
Download for v 15.0 Deploy on Odoo.sh
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 547
Technical Name smile_audit
LicenseLGPL-3
Websitehttps://www.smile.eu/
Versions 13.0 8.0 6.1 10.0 11.0 12.0 14.0 15.0 16.0 9.0
You bought this module and need support? Click here!

Audit Trail

License: LGPL-3 Smile-SA/odoo_addons

This module lets administrator track every user's operation on all the objects of the system (for the moment, only create, write and unlink methods). Each rule for tracking user's operation on data through the Odoo's interface is called audit rule.

Features:

  • The administrator creates an audit rule by specifying the name and the module on which the rule will be applied,
  • The administrator ticks the operations he wants to follow (creation and/or modification and/or deletion),
  • The administrator selects the group of users concerned by the audit.
  • A rule can be disabled if the administrator does not want to follow its logs anymore.
  • Operations performed by a user will be automatically recorded in the list of logs according to the pre-defined rule.
  • The log view contains details about each operation: date, name, the module, the user, old and new values of each modified field, etc.
  • The module also allows a history revision of each operation.
  • The administrator can delete audit rules but logs can't be deleted.
  • Users can view a list of current model logs.

Table of contents

Usage

To create a new rule:

  1. Go to Settings > Audit > Rules menu.

  2. Press the button Create.

  3. Insert the name of the rule, the model and the user group. Then check operations you want to audit.

    Audit rule

To show the list of logs and edit a log:

  1. Go to Settings > Audit > Logs menu.

    List of audit logs
  2. Display the log by clicking on a line to see more details about the operation and changes.

    Line of log

To view different versions of the object:

  1. Click on the smart button History Revision.

    Line of log
  2. Corresponding history:

    History revision

To view logs of displayed model:

  1. Select one or multiple lines from the list view.

  2. Go to Action > View audit logs.

    View audit logs

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.

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

GDPR / EU Privacy

This addons does not collect any data and does not set any browser cookies.

Credits

Contributors

  • Corentin POUHET-BRUNERIE

Maintainer

This module is maintained by Smile SA.

Since 1991 Smile has been a pioneer of technology and also the European expert in open source solutions.

Smile SA

This module is part of the odoo-addons project on GitHub.

You are welcome to contribute.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.
There are no ratings yet!
Uninstalling issues
by
Pete Charalampopoulos
on 8/2/23, 11:57 AM

I'm trying to uninstall this module and i constantly get an error:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 85, in lookup
    r = d[key]
  File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 71, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 34, in __getitem__
    a = self.d[obj]
KeyError: ('audit.rule', )

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 357, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 921, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 546, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1328, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1316, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 464, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 451, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/wizard/base_module_uninstall.py", line 59, in action_uninstall
    return modules.button_immediate_uninstall()
  File "", line 2, in button_immediate_uninstall
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
    return method(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 628, in button_immediate_uninstall
    return self._button_immediate_function(type(self).button_uninstall)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 603, in _button_immediate_function
    registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 538, in load_modules
    Module.browse(modules_to_remove.values()).module_uninstall()
  File "/usr/lib/python3/dist-packages/odoo/addons/helpdesk/models/ir_module.py", line 18, in module_uninstall
    return super().module_uninstall()
  File "/usr/lib/python3/dist-packages/odoo/addons/base_import_module/models/ir_module.py", line 256, in module_uninstall
    res = super().module_uninstall()
  File "", line 2, in module_uninstall
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
    return method(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 502, in module_uninstall
    self.with_context(prefetch_fields=False).write({'state': 'uninstalled', 'latest_version': False})
  File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_module_module.py", line 96, in write
    return super(IrModuleModule, self).write(vals)
  File "/usr/lib/python3/dist-packages/odoo/addons/account/models/ir_module_module.py", line 26, in write
    return super().write(values)
  File "/usr/lib/python3/dist-packages/odoo/custom-addons/smile_audit/models/base.py", line 103, in write
    if not self._get_audit_rule('write'):
  File "/usr/lib/python3/dist-packages/odoo/custom-addons/smile_audit/models/base.py", line 58, in _get_audit_rule
    rule_id = AuditRule._check_audit_rule(group_ids).get(
  File "", line 2, in _check_audit_rule
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/custom-addons/smile_audit/models/audit_rule.py", line 79, in _check_audit_rule
    rules = self.sudo().search([
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 1811, in search
    return res if count else self.browse(res)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 5176, in browse
    if not ids:
  File "/usr/lib/python3/dist-packages/odoo/osv/query.py", line 215, in __bool__
    return bool(self._result)
  File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 26, in __get__
    value = self.fget(obj)
  File "/usr/lib/python3/dist-packages/odoo/osv/query.py", line 208, in _result
    self._cr.execute(query_str, params)
  File "", line 2, in execute
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 90, in check
    return f(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 311, in execute
    res = self._obj.execute(query, params)
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 654, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
psycopg2.errors.UndefinedTable: relation "audit_rule" does not exist
LINE 1: SELECT "audit_rule".id FROM "audit_rule" WHERE (("audit_rule...