Browse Source

Merge pull request #701 from StefanRijnhart/8.0-auditlog_concurrency_rollback

[FIX] Request id no longer exists after concurrency rollback
pull/751/head
Dave Lasley 8 years ago
committed by GitHub
parent
commit
aca89e2456
  1. 8
      auditlog/models/http_request.py

8
auditlog/models/http_request.py

@ -2,6 +2,7 @@
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from psycopg2.extensions import AsIs
from openerp import models, fields, api
from openerp.http import request
@ -47,6 +48,13 @@ class AuditlogHTTPRequest(models.Model):
httprequest = request.httprequest
if httprequest:
if hasattr(httprequest, 'auditlog_http_request_id'):
# Verify existence. Could have been rolled back after a
# concurrency error
self.env.cr.execute(
"SELECT id FROM %s WHERE id = %s", (
AsIs(self._table),
httprequest.auditlog_http_request_id))
if self.env.cr.fetchone():
return httprequest.auditlog_http_request_id
vals = {
'name': httprequest.path,

Loading…
Cancel
Save