diff --git a/auditlog/models/http_request.py b/auditlog/models/http_request.py
index 77f9aa09f..7d6b19d48 100644
--- a/auditlog/models/http_request.py
+++ b/auditlog/models/http_request.py
@@ -27,7 +27,9 @@ class AuditlogHTTPRequest(models.Model):
_name = 'auditlog.http.request'
_description = u"Auditlog - HTTP request log"
_order = "create_date DESC"
+ _rec_name = 'display_name'
+ display_name = fields.Char(u"Name", compute="_display_name")
name = fields.Char(u"Path")
root_url = fields.Char(u"Root URL")
user_id = fields.Many2one(
@@ -38,6 +40,16 @@ class AuditlogHTTPRequest(models.Model):
log_ids = fields.One2many(
'auditlog.log', 'http_request_id', string=u"Logs")
+ @api.multi
+ def _display_name(self):
+ for httprequest in self:
+ create_date = fields.Datetime.from_string(httprequest.create_date)
+ tz_create_date = fields.Datetime.context_timestamp(
+ httprequest, create_date)
+ httprequest.display_name = u"%s (%s)" % (
+ httprequest.name or '?',
+ fields.Datetime.to_string(tz_create_date))
+
@api.model
def current_http_request(self):
"""Create a log corresponding to the current HTTP request, and returns
diff --git a/auditlog/models/http_session.py b/auditlog/models/http_session.py
index 2bbf736e6..046a10fa7 100644
--- a/auditlog/models/http_session.py
+++ b/auditlog/models/http_session.py
@@ -27,13 +27,25 @@ class AuditlogtHTTPSession(models.Model):
_name = 'auditlog.http.session'
_description = u"Auditlog - HTTP User session log"
_order = "create_date DESC"
+ _rec_name = 'display_name'
+ display_name = fields.Char(u"Name", compute="_display_name")
name = fields.Char(u"Session ID")
user_id = fields.Many2one(
'res.users', string=u"User")
http_request_ids = fields.One2many(
'auditlog.http.request', 'http_session_id', string=u"HTTP Requests")
+ @api.multi
+ def _display_name(self):
+ for httpsession in self:
+ create_date = fields.Datetime.from_string(httpsession.create_date)
+ tz_create_date = fields.Datetime.context_timestamp(
+ httpsession, create_date)
+ httpsession.display_name = u"%s (%s)" % (
+ httpsession.user_id and httpsession.user_id.name or '?',
+ fields.Datetime.to_string(tz_create_date))
+
@api.model
def current_http_session(self):
"""Create a log corresponding to the current HTTP user session, and
diff --git a/auditlog/views/http_request_view.xml b/auditlog/views/http_request_view.xml
index 0011eb55d..2169ed0f9 100644
--- a/auditlog/views/http_request_view.xml
+++ b/auditlog/views/http_request_view.xml
@@ -12,11 +12,8 @@
-
-
-
-
+
@@ -33,7 +30,6 @@
-
diff --git a/auditlog/views/http_session_view.xml b/auditlog/views/http_session_view.xml
index 4fc2e3bdc..942da68af 100644
--- a/auditlog/views/http_session_view.xml
+++ b/auditlog/views/http_session_view.xml
@@ -10,8 +10,8 @@
-
+
@@ -27,8 +27,8 @@
-
+