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

7 years ago
  1. # © 2015 ABF OSIELL <https://osiell.com>
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  3. from odoo import models, fields
  4. class AuditlogLog(models.Model):
  5. _name = 'auditlog.log'
  6. _description = "Auditlog - Log"
  7. _order = "create_date desc"
  8. name = fields.Char("Resource Name", size=64)
  9. model_id = fields.Many2one(
  10. 'ir.model', string="Model")
  11. res_id = fields.Integer("Resource ID")
  12. user_id = fields.Many2one(
  13. 'res.users', string="User")
  14. method = fields.Char("Method", size=64)
  15. line_ids = fields.One2many(
  16. 'auditlog.log.line', 'log_id', string="Fields updated")
  17. http_session_id = fields.Many2one(
  18. 'auditlog.http.session', string="Session")
  19. http_request_id = fields.Many2one(
  20. 'auditlog.http.request', string="HTTP Request")
  21. log_type = fields.Selection(
  22. [('full', "Full log"),
  23. ('fast', "Fast log"),
  24. ],
  25. string="Type")
  26. class AuditlogLogLine(models.Model):
  27. _name = 'auditlog.log.line'
  28. _description = "Auditlog - Log details (fields updated)"
  29. field_id = fields.Many2one(
  30. 'ir.model.fields', ondelete='cascade', string="Field", required=True)
  31. log_id = fields.Many2one(
  32. 'auditlog.log', string="Log", ondelete='cascade', index=True)
  33. old_value = fields.Text("Old Value")
  34. new_value = fields.Text("New Value")
  35. old_value_text = fields.Text("Old value Text")
  36. new_value_text = fields.Text("New value Text")
  37. field_name = fields.Char("Technical name", related='field_id.name')
  38. field_description = fields.Char(
  39. "Description", related='field_id.field_description')