[FIX] problem when multiple instances of the web client run in tabs and we disconnect...
authorniv-openerp <nicolas.vanhoren@openerp.com>
Tue, 8 Jan 2013 16:41:04 +0000 (17:41 +0100)
committerniv-openerp <nicolas.vanhoren@openerp.com>
Tue, 8 Jan 2013 16:41:04 +0000 (17:41 +0100)
lp bug: https://launchpad.net/bugs/1093671 fixed

bzr revid: nicolas.vanhoren@openerp.com-20130108164104-7wv2yxlrczqmicvb

addons/web/session.py
addons/web/static/src/js/chrome.js

index fa99f58..30e9308 100644 (file)
@@ -18,6 +18,9 @@ _logger = logging.getLogger(__name__)
 class AuthenticationError(Exception):
     pass
 
+class SessionExpiredException(Exception):
+    pass
+
 class Service(object):
     def __init__(self, session, service_name):
         self.session = session
@@ -152,6 +155,8 @@ class OpenERPSession(object):
         :type model: str
         :rtype: a model object
         """
+        if self._db == False:
+            raise SessionExpiredException("Session expired")
 
         return Model(self, model)
 
index 26d30ea..30a5102 100644 (file)
@@ -247,6 +247,11 @@ instance.web.CrashManager = instance.web.Class.extend({
         if (!this.active) {
             return;
         }
+        // yes, exception handling is shitty
+        if (error.code === 300 && error.data && error.data.type == "client_exception" && error.data.debug.match("SessionExpiredException")) {
+            this.show_warning({type: "Session Expired", data: { fault_code: "Your OpenERP session expired. Please refresh the current web page." }});
+            return;
+        }
         if (error.data.fault_code) {
             var split = ("" + error.data.fault_code).split('\n')[0].split(' -- ');
             if (split.length > 1) {