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.

46 lines
1.7 KiB

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