Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
45 changes: 21 additions & 24 deletions auditlog/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=========
Audit Log
=========
Expand All @@ -17,7 +13,7 @@ Audit Log
.. |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/license-AGPL--3-blue.png
.. |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
Expand Down Expand Up @@ -82,10 +78,10 @@ right to configure the auditlog configuration rules.
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
- 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
===========
Expand All @@ -108,25 +104,26 @@ Authors
Contributors
------------

- Sebastien Alix <sebastien.alix@camptocamp.com>
- Holger Brunn <hbrunn@therp.nl>
- Holden Rehg <holdenrehg@gmail.com>
- Eric Lembregts <eric@lembregts.eu>
- Pieter Paulussen <pieter.paulussen@me.com>
- Alan Ramos <alan.ramos@jarsa.com.mx>
- Stefan Rijnhart <stefan@opener.amsterdam>
- Bhavesh Odedra <bodedra@opensourceintegrators.com>
- Hardik Suthar <hsuthar@opensourceintegrators.com>
- Kitti U. <kittiu@ecosoft.co.th>
- Bogdan Valentin Gabor <valentin.gabor@bt-group.com>
- Dennis Sluijk d.sluijk@onestein.nl
- Adam Heinz <adam.heinz@metricwise.com>
- Sebastien Alix <sebastien.alix@camptocamp.com>
- Holger Brunn <hbrunn@therp.nl>
- Holden Rehg <holdenrehg@gmail.com>
- Eric Lembregts <eric@lembregts.eu>
- Pieter Paulussen <pieter.paulussen@me.com>
- Alan Ramos <alan.ramos@jarsa.com.mx>
- Stefan Rijnhart <stefan@opener.amsterdam>
- Bhavesh Odedra <bodedra@opensourceintegrators.com>
- Hardik Suthar <hsuthar@opensourceintegrators.com>
- Kitti U. <kittiu@ecosoft.co.th>
- Bogdan Valentin Gabor <valentin.gabor@bt-group.com>
- Dennis Sluijk d.sluijk@onestein.nl
- Adam Heinz <adam.heinz@metricwise.com>
- Baptiste P. <baptiste@newlogic.com>

Other credits
-------------

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

Maintainers
-----------
Expand Down
2 changes: 2 additions & 0 deletions auditlog/models/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ def create_logs(
"""Create logs. `old_values` and `new_values` are dictionaries, e.g:
{RES_ID: {'FIELD': VALUE, ...}}
"""
if self.env.context.get("auditlog_skip", False):
return None
if old_values is None:
old_values = EMPTY_DICT
if new_values is None:
Expand Down
1 change: 1 addition & 0 deletions auditlog/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
- Bogdan Valentin Gabor \<<valentin.gabor@bt-group.com>\>
- Dennis Sluijk <d.sluijk@onestein.nl>
- Adam Heinz \<<adam.heinz@metricwise.com>\>
- Baptiste P. \<<baptiste@newlogic.com>\>
31 changes: 13 additions & 18 deletions auditlog/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Audit Log</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="audit-log">
<h1 class="title">Audit Log</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="audit-log">
<h1>Audit Log</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:640cebebade3d31225c8be2a00876278817c0d5a3c6d9965afe6f6cc2f7de40c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/18.0/auditlog"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-auditlog"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/server-tools/tree/18.0/auditlog"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-auditlog"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows the administrator to log user operations performed on
data models such as <tt class="docutils literal">create</tt>, <tt class="docutils literal">read</tt>, <tt class="docutils literal">write</tt> and <tt class="docutils literal">delete</tt>.</p>
<p><strong>Table of contents</strong></p>
Expand All @@ -393,7 +388,7 @@ <h1>Audit Log</h1>
</ul>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>Go to Settings / Technical / Audit / Rules to subscribe rules. A rule
defines which operations to log for a given data model.</p>
<p><img alt="image" src="https://raw.githubusercontent.com/OCA/server-tools/18.0/auditlog/static/description/rule.png" /></p>
Expand All @@ -417,7 +412,7 @@ <h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
right to configure the auditlog configuration rules.</p>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<blockquote>
<ul class="simple">
<li>log only operations triggered by some users (currently it logs all
Expand All @@ -428,23 +423,23 @@ <h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
</blockquote>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">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 to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20auditlog%0Aversion:%2018.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">
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>ABF OSIELL</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li>Sebastien Alix &lt;<a class="reference external" href="mailto:sebastien.alix&#64;camptocamp.com">sebastien.alix&#64;camptocamp.com</a>&gt;</li>
<li>Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;therp.nl">hbrunn&#64;therp.nl</a>&gt;</li>
Expand All @@ -459,17 +454,18 @@ <h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<li>Bogdan Valentin Gabor &lt;<a class="reference external" href="mailto:valentin.gabor&#64;bt-group.com">valentin.gabor&#64;bt-group.com</a>&gt;</li>
<li>Dennis Sluijk <a class="reference external" href="mailto:d.sluijk&#64;onestein.nl">d.sluijk&#64;onestein.nl</a></li>
<li>Adam Heinz &lt;<a class="reference external" href="mailto:adam.heinz&#64;metricwise.com">adam.heinz&#64;metricwise.com</a>&gt;</li>
<li>Baptiste P. &lt;<a class="reference external" href="mailto:baptiste&#64;newlogic.com">baptiste&#64;newlogic.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
<h3><a class="toc-backref" href="#toc-entry-7">Other credits</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">Other credits</a></h2>
<ul class="simple">
<li>Icon: built with different icons from the <a class="reference external" href="https://en.wikipedia.org/wiki/Oxygen_Project">Oxygen
theme</a> (LGPL)</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-8">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" />
Expand All @@ -482,6 +478,5 @@ <h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
19 changes: 19 additions & 0 deletions auditlog/tests/test_auditlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,25 @@ def test_LogDelete(self):
1,
)

def test_LogSkipped(self):
"""Tests environment variable to skip the logs results"""
self.groups_rule.subscribe()
group = (
self.env["res.groups"]
.with_context(auditlog_skip=True)
.create({"name": "testgroup1"})
)
group.with_context(auditlog_skip=True).unlink()
self.assertEqual(
self.env["auditlog.log"].search_count(
[
("model_id", "=", self.groups_model_id),
("res_id", "=", group.id),
]
),
0,
)


class TestAuditlogFull(AuditLogRuleCommon, AuditlogCommon):
@classmethod
Expand Down