You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
45 lines
1.6 KiB
# © 2015 ABF OSIELL <https://osiell.com>
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
from odoo import models, fields
|
|
|
|
|
|
class AuditlogLog(models.Model):
|
|
_name = 'auditlog.log'
|
|
_description = "Auditlog - Log"
|
|
_order = "create_date desc"
|
|
|
|
name = fields.Char("Resource Name", size=64)
|
|
model_id = fields.Many2one(
|
|
'ir.model', string="Model")
|
|
res_id = fields.Integer("Resource ID")
|
|
user_id = fields.Many2one(
|
|
'res.users', string="User")
|
|
method = fields.Char("Method", size=64)
|
|
line_ids = fields.One2many(
|
|
'auditlog.log.line', 'log_id', string="Fields updated")
|
|
http_session_id = fields.Many2one(
|
|
'auditlog.http.session', string="Session")
|
|
http_request_id = fields.Many2one(
|
|
'auditlog.http.request', string="HTTP Request")
|
|
log_type = fields.Selection(
|
|
[('full', "Full log"),
|
|
('fast', "Fast log"),
|
|
],
|
|
string="Type")
|
|
|
|
|
|
class AuditlogLogLine(models.Model):
|
|
_name = 'auditlog.log.line'
|
|
_description = "Auditlog - Log details (fields updated)"
|
|
|
|
field_id = fields.Many2one(
|
|
'ir.model.fields', ondelete='cascade', string="Field", required=True)
|
|
log_id = fields.Many2one(
|
|
'auditlog.log', string="Log", ondelete='cascade', index=True)
|
|
old_value = fields.Text("Old Value")
|
|
new_value = fields.Text("New Value")
|
|
old_value_text = fields.Text("Old value Text")
|
|
new_value_text = fields.Text("New value Text")
|
|
field_name = fields.Char("Technical name", related='field_id.name')
|
|
field_description = fields.Char(
|
|
"Description", related='field_id.field_description')
|