Browse Source

singleton error if we saved the current session two times (#473)

* [IMP] index the columns we'll be searching for for every request

* [FIX] singleton error if we saved the current session two times
pull/707/head
Holger Brunn 9 years ago
committed by Frédéric Garbely
parent
commit
a993256284
  1. 7
      auditlog/models/http_session.py

7
auditlog/models/http_session.py

@ -13,9 +13,9 @@ class AuditlogtHTTPSession(models.Model):
_rec_name = 'display_name' _rec_name = 'display_name'
display_name = fields.Char(u"Name", compute="_display_name") display_name = fields.Char(u"Name", compute="_display_name")
name = fields.Char(u"Session ID")
name = fields.Char(u"Session ID", index=True)
user_id = fields.Many2one( user_id = fields.Many2one(
'res.users', string=u"User")
'res.users', string=u"User", index=True)
http_request_ids = fields.One2many( http_request_ids = fields.One2many(
'auditlog.http.request', 'http_session_id', string=u"HTTP Requests") 'auditlog.http.request', 'http_session_id', string=u"HTTP Requests")
@ -43,7 +43,8 @@ class AuditlogtHTTPSession(models.Model):
if httpsession: if httpsession:
existing_session = self.search( existing_session = self.search(
[('name', '=', httpsession.sid), [('name', '=', httpsession.sid),
('user_id', '=', request.uid)])
('user_id', '=', request.uid)],
limit=1)
if existing_session: if existing_session:
return existing_session.id return existing_session.id
vals = { vals = {

Loading…
Cancel
Save