Repository
OCA/server-tools · module folder · Try on Runboat
Module version
2.0.0
Category
Tools
Folder size
1.95 MB
License
AGPL-3
Application
Yes
Auto-installable
No
Website
https://github.com/OCA/server-tools
Last tracking update
2026-08-07 09:06:26
Authors
Odoo Community Association (OCA), ABF OSIELL
Maintainers
Odoo Community Association (OCA), ABF OSIELL
Committers
Stefan Rijnhart, Cuong, Nguyen Minh Tran Manh, Weblate, Hembert Iregui, OCA-git-bot, oca-ci
Odoo dependencies
odoo/odoo:
Python dependencies
None
System dependencies
None
Required by
test_auditlog
Description
This module allows the administrator to log user operations performed on
data models such as `create`, `read`, `write` and `delete`.

Code Analysis

Views touched (14)
XML IDNameModelTypeStatus
view_auditlog_http_request_form auditlog.http.request.form auditlog.http.request form New
view_auditlog_http_request_search auditlog.http.request.search auditlog.http.request search New
view_auditlog_http_request_tree auditlog.http.request.list auditlog.http.request list New
view_auditlog_http_session_form auditlog.http.session.form auditlog.http.session form New
view_auditlog_http_session_search auditlog.http.session.search auditlog.http.session search New
view_auditlog_http_session_tree auditlog.http.session.list auditlog.http.session list New
view_auditlog_line_search auditlog.line.search auditlog.log.line.view search New
view_auditlog_line_tree view.auditlog.line.list auditlog.log.line.view list New
view_auditlog_log_form auditlog.log.form auditlog.log form New
view_auditlog_log_search auditlog.log.search auditlog.log search New
view_auditlog_log_tree auditlog.log.list auditlog.log list New
view_auditlog_rule_form auditlog.rule.form auditlog.rule form New
view_auditlog_rule_search auditlog.rule.search auditlog.rule search New
view_auditlog_rule_tree auditlog.rule.list auditlog.rule list New
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (7)

New fields (0)

No new fields.

Public methods (1)
  • autovacuum(self, days, chunk_size=None)
    @api.model
    Delete all logs older than ``days``. This includes: - CRUD logs (create, read, write, unlink) - HTTP requests - HTTP user sessions Called from a cron.

New fields (7)
  • display_name Char
    compute='_compute_display_name' store=True args: 'Name'
  • http_session_id Many2one → auditlog.http.session
    index=True string='Session' args: 'auditlog.http.session'
  • log_ids One2many → auditlog.log
    string='Logs' args: 'auditlog.log', 'http_request_id'
  • name Char
    args: 'Path'
  • root_url Char
    args: 'Root URL'
  • user_context Char
    args: 'Context'
  • user_id Many2one → res.users
    string='User' args: 'res.users'
Public methods (1)
  • current_http_request(self)
    @api.model
    Create a log corresponding to the current HTTP request, and returns its ID. This method can be called several times during the HTTP query/response cycle, it will only log the request on the first call. If no HTTP request is available, returns `False`.

New fields (4)
  • display_name Char
    compute='_compute_display_name' store=True args: 'Name'
  • http_request_ids One2many → auditlog.http.request
    string='HTTP Requests' args: 'auditlog.http.request', 'http_session_id'
  • name Char
    index=True args: 'Session ID'
  • user_id Many2one → res.users
    index=True string='User' args: 'res.users'
Public methods (1)
  • current_http_session(self)
    @api.model
    Create a log corresponding to the current HTTP user session, and returns its ID. This method can be called several times during the HTTP query/response cycle, it will only log the user session on the first call. If no HTTP user session is available, returns `False`.

New fields (12)
  • http_request_id Many2one → auditlog.http.request
    index=True string='HTTP Request' args: 'auditlog.http.request'
  • http_session_id Many2one → auditlog.http.session
    index=True string='Session' args: 'auditlog.http.session'
  • line_ids One2many → auditlog.log.line
    string='Fields updated' args: 'auditlog.log.line', 'log_id'
  • log_type Selection
    string='Type' args: [('full', 'Full log'), ('fast', 'Fast log')]
  • method Char
    size=64
  • model_id Many2one → ir.model
    index=True ondelete='set null' string='Model' args: 'ir.model'
  • model_model Char
    readonly=True string='Technical Model Name'
  • model_name Char
    readonly=True
  • name Char
    size=64 args: 'Resource Name'
  • res_id Integer
    args: 'Resource ID'
  • res_ids Char
    args: 'Resource IDs'
  • user_id Many2one → res.users
    string='User' args: 'res.users'
Public methods (3)
  • create(self, vals_list)
    @api.model_create_multi
    Insert model_name and model_model field values upon creation.
  • show_res_ids(self)
  • write(self, vals)
    Update model_name and model_model field values to reflect model_id changes.

New fields (8)
  • field_description Char
    readonly=True args: 'Description'
  • field_id Many2one → ir.model.fields
    index=True ondelete='set null' args: 'ir.model.fields'
  • field_name Char
    readonly=True args: 'Technical name'
  • log_id Many2one → auditlog.log
    index=True ondelete='cascade' args: 'auditlog.log'
  • new_value Text
  • new_value_text Text
    args: 'New value Text'
  • old_value Text
  • old_value_text Text
    args: 'Old value Text'
Public methods (2)
  • create(self, vals_list)
    @api.model_create_multi
    Ensure field_id is not empty on creation and store field_name and field_description.
  • write(self, vals)
    Ensure field_id is set during write and update field_name and field_description values.

New fields (10)
  • http_request_id Many2one → auditlog.http.request
    index=True string='HTTP Request' args: 'auditlog.http.request'
  • http_session_id Many2one → auditlog.http.session
    index=True string='Session' args: 'auditlog.http.session'
  • log_type Selection
    selection=<expr> string='Type'
  • method Char
  • model_id Many2one → ir.model
    args: 'ir.model'
  • model_model Char
  • model_name Char
  • name Char
  • res_id Integer
  • user_id Many2one → res.users
    args: 'res.users'
Public methods (0)

No public methods.

New fields (16)
  • action_id Many2one → ir.actions.act_window
    string='Action' args: 'ir.actions.act_window'
  • capture_record Boolean
    help='In case of full logging, also log all values of records at the time of deletion.' string='Log values on deletion'
  • fields_to_exclude_ids Many2many → ir.model.fields
    domain="[('model_id', '=', model_id)]" help='Changes made to these fields are not logged.' string='Fields to Exclude' args: 'ir.model.fields'
  • log_create Boolean
    default=True help='Select this if you want to keep track of creation on any record of the model of this rule' args: 'Log Creates'
  • log_export_data Boolean
    default=True help='Select this if you want to keep track of exports of the model of this rule' args: 'Log Exports'
  • log_read Boolean
    help='Select this if you want to keep track of read/open on any record of the model of this rule' args: 'Log Reads'
  • log_type Selection
    default='full' help='Full log: the previous values of updated fields are retrieved and stored on the log lines. This includes stored computed fields on the updated records that may be affected by the new values of other fields.\nFast log: only log the new values assigned through the create and write operations (less information, but it is faster).' required=True string='Type' args: [('full', 'Full log'), ('fast', 'Fast log')]
  • log_unlink Boolean
    default=True help='Select this if you want to keep track of deletion on any record of the model of this rule' args: 'Log Deletes'
  • log_write Boolean
    default=True help='Select this if you want to keep track of modification on any record of the model of this rule' args: 'Log Writes'
  • model_id Many2one → ir.model
    help='Select model for which you want to generate log.' index=True ondelete='set null' args: 'ir.model', 'Model'
  • model_model Char
    readonly=True string='Technical Model Name'
  • model_name Char
    readonly=True
  • name Char
    required=True
  • state Selection
    default='draft' required=True args: [('draft', 'Draft'), ('confirmed', 'Confirmed')]
  • user_ids Many2many → res.users
    help='if no user is added then it will applicable for all users' string='Users' args: 'res.users', 'audittail_rules_users', 'user_id', 'rule_id'
  • users_to_exclude_ids Many2many → res.users
    context={'active_test': False} help='Changes made by these users are not logged.' string='Users to Exclude' args: 'res.users'
Public methods (7)
  • create(self, vals_list)
    @api.model_create_multi
    Update the registry when a new rule is created.
  • create_logs(self, uid, res_model, res_ids, method, old_values=None, new_values=None, additional_log_values=None)
    Create logs. `old_values` and `new_values` are dictionaries, e.g: {RES_ID: {'FIELD': VALUE, ...}}
  • get_auditlog_fields(self, model)
    @api.model
    Get the list of auditlog fields for a model By default it is all stored fields only, but you can override this.
  • set_to_confirmed(self)
    Confirm Rule for auditing changes on model and apply shortcut to view logs on that model.
  • set_to_draft(self)
    Reset Auditlog Rules state to draft.
  • unlink(self)
    Set rules to draft before removing them.
  • write(self, vals)
    Update the registry when existing rules are updated.

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…