From 1f747d892c08354a96b5bbbe3744496341e64c22 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 24 Aug 2012 16:35:38 +0200 Subject: [PATCH 01/16] [IMP] reload static paths when new modules are availables bzr revid: chs@openerp.com-20120824143538-49u29wyaojakhzfu --- addons/web/__init__.py | 1 + addons/web/__openerp__.py | 1 + addons/web/common/http.py | 25 +++++++++++++++---------- openerp-web | 3 ++- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/addons/web/__init__.py b/addons/web/__init__.py index 621931e9167..4425f3ce572 100644 --- a/addons/web/__init__.py +++ b/addons/web/__init__.py @@ -2,6 +2,7 @@ import logging from . import common from . import controllers +from . import ir_module _logger = logging.getLogger(__name__) diff --git a/addons/web/__openerp__.py b/addons/web/__openerp__.py index fa32a8595cc..65a7939d8bb 100644 --- a/addons/web/__openerp__.py +++ b/addons/web/__openerp__.py @@ -1,6 +1,7 @@ { 'name': 'Web', 'category': 'Hidden', + 'version': '7.0.1.0', 'description': """ OpenERP Web core module. diff --git a/addons/web/common/http.py b/addons/web/common/http.py index 9c3664c8da0..4cb5b8d4bf8 100644 --- a/addons/web/common/http.py +++ b/addons/web/common/http.py @@ -461,7 +461,7 @@ class Root(object): only used in case the list of databases is requested by the server, will be filtered by this pattern """ - def __init__(self, options, openerp_addons_namespace=True): + def __init__(self, options): self.config = options if not hasattr(self.config, 'connector'): @@ -473,11 +473,9 @@ class Root(object): self.httpsession_cookie = 'httpsessionid' self.addons = {} + self.statics = {} - static_dirs = self._load_addons(openerp_addons_namespace) - if options.serve_static: - app = werkzeug.wsgi.SharedDataMiddleware( self.dispatch, static_dirs) - self.dispatch = DisableCacheMiddleware(app) + self._load_addons() if options.session_storage: if not os.path.exists(options.session_storage): @@ -490,7 +488,7 @@ class Root(object): """ return self.dispatch(environ, start_response) - def dispatch(self, environ, start_response): + def _dispatch(self, environ, start_response): """ Performs the actual WSGI dispatching for the application, may be wrapped during the initialization of the object. @@ -520,12 +518,13 @@ class Root(object): return response(environ, start_response) - def _load_addons(self, openerp_addons_namespace=True): + def _load_addons(self): """ Loads all addons at the specified addons path, returns a mapping of static URLs to the corresponding directories """ - statics = {} + openerp_addons_namespace = getattr(self.config, 'openerp_addons_namespace', True) + for addons_path in self.config.addons_path: for module in os.listdir(addons_path): if module not in addons_module: @@ -541,14 +540,20 @@ class Root(object): m = __import__(module) addons_module[module] = m addons_manifest[module] = manifest - statics['/%s/static' % module] = path_static + self.statics['/%s/static' % module] = path_static + for k, v in controllers_class: if k not in controllers_object: o = v() controllers_object[k] = o if hasattr(o, '_cp_path'): controllers_path[o._cp_path] = o - return statics + + app = self._dispatch + if self.config.serve_static: + app = werkzeug.wsgi.SharedDataMiddleware(self._dispatch, self.statics) + + self.dispatch = DisableCacheMiddleware(app) def find_handler(self, *l): """ diff --git a/openerp-web b/openerp-web index 3340b95646e..2e12a96ef64 100755 --- a/openerp-web +++ b/openerp-web @@ -105,7 +105,8 @@ if __name__ == "__main__": else: logging.basicConfig(level=getattr(logging, options.log_level.upper())) - app = web.common.http.Root(options, openerp_addons_namespace=False) + options.openerp_addons_namespace = False + app = web.common.http.Root(options) if options.proxy_mode: app = werkzeug.contrib.fixers.ProxyFix(app) From 522fb2e4b9fdf46abed3b5ca8ba43758b22253a1 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 24 Aug 2012 16:38:37 +0200 Subject: [PATCH 02/16] [FIX] add missing file bzr revid: chs@openerp.com-20120824143837-tpgu7g2rqnkag22u --- addons/web/ir_module.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 addons/web/ir_module.py diff --git a/addons/web/ir_module.py b/addons/web/ir_module.py new file mode 100644 index 00000000000..4ed47e5197c --- /dev/null +++ b/addons/web/ir_module.py @@ -0,0 +1,17 @@ +from openerp.osv import osv +import openerp.wsgi.core as oewsgi + +from common.http import Root + +class ir_module(osv.Model): + _inherit = 'ir.module.module' + + def update_list(self, cr, uid, context=None): + result = super(ir_module, self).update_list(cr, uid, context=context) + + if tuple(result) != (0, 0): + for handler in oewsgi.module_handlers: + if isinstance(handler, Root): + handler._load_addons() + + return result From ad02628855b2b1ae815661df5905140d47f0c884 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 27 Sep 2012 15:34:44 +0200 Subject: [PATCH 03/16] [IMP] web: add method do_action to EmbeddedClient bzr revid: chs@openerp.com-20120927133444-6dd5ck2jmjfoa9my --- addons/web/static/src/js/chrome.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 9fdfb50307f..fcb4747a2e0 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1174,6 +1174,9 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ var self = this; return $.when(this._super()).pipe(function() { return instance.session.session_authenticate(self.dbname, self.login, self.key, true).pipe(function() { + if (!self.action_id) { + return; + } return self.rpc("/web/action/load", { action_id: self.action_id }, function(result) { var action = result.result; action.flags = _.extend({ @@ -1184,11 +1187,15 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ //pager : false }, self.options, action.flags || {}); - self.action_manager.do_action(action); + self.do_action(action); }); }); }); }, + + do_action: function(action) { + return this.action_manager.do_action(action); + } }); instance.web.embed = function (origin, dbname, login, key, action, options) { From aa7a56706bc6cd58f7254279da4371e2c13484c2 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 1 Oct 2012 18:44:58 +0200 Subject: [PATCH 04/16] [IMP] version_info read info from server bzr revid: chs@openerp.com-20121001164458-6bkchfr2qoll0qq9 --- addons/web/controllers/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index e2e7ebb68de..e27a07ce1cc 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -696,9 +696,7 @@ class WebClient(openerpweb.Controller): @openerpweb.jsonrequest def version_info(self, req): - return { - "version": common.release.version - } + return req.proxy('common').version()['openerp'] class Proxy(openerpweb.Controller): _cp_path = '/web/proxy' From 590b79fe96e9a4e1539242052dead57057d87d12 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 2 Oct 2012 17:55:03 +0200 Subject: [PATCH 05/16] [FIX] correct version_info bzr revid: chs@openerp.com-20121002155503-ok9m0lud5ajmno3f --- addons/web/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index e27a07ce1cc..5b2129a47f8 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -696,7 +696,7 @@ class WebClient(openerpweb.Controller): @openerpweb.jsonrequest def version_info(self, req): - return req.proxy('common').version()['openerp'] + return req.session.proxy('common').version()['openerp'] class Proxy(openerpweb.Controller): _cp_path = '/web/proxy' From ba76751ea1fe90dffec5b37f5046039fb9e105c3 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 10 Oct 2012 14:00:26 +0200 Subject: [PATCH 06/16] [FIX] file renamed on server bzr revid: chs@openerp.com-20121010120026-lorll9na2ndt80py --- addons/web/ir_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/ir_module.py b/addons/web/ir_module.py index 4ed47e5197c..5bc76a99375 100644 --- a/addons/web/ir_module.py +++ b/addons/web/ir_module.py @@ -1,5 +1,5 @@ from openerp.osv import osv -import openerp.wsgi.core as oewsgi +import openerp.service.wsgi_server as oewsgi from common.http import Root From 907b9700be95419684b356f0d8b2ec551cf2a713 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 11 Oct 2012 13:23:00 +0200 Subject: [PATCH 07/16] [FIX] adapt to drop of standalone web client bzr revid: chs@openerp.com-20121011112300-cfhvxh4d9gg6o17l --- addons/web/http.py | 5 +---- addons/web/ir_module.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/addons/web/http.py b/addons/web/http.py index 13f99776135..5db3f8aedef 100644 --- a/addons/web/http.py +++ b/addons/web/http.py @@ -526,10 +526,7 @@ class Root(object): if hasattr(o, '_cp_path'): controllers_path[o._cp_path] = o - app = self._dispatch - if self.config.serve_static: - app = werkzeug.wsgi.SharedDataMiddleware(self._dispatch, self.statics) - + app = werkzeug.wsgi.SharedDataMiddleware(self._dispatch, self.statics) self.dispatch = DisableCacheMiddleware(app) def find_handler(self, *l): diff --git a/addons/web/ir_module.py b/addons/web/ir_module.py index 5bc76a99375..c4588b19aa6 100644 --- a/addons/web/ir_module.py +++ b/addons/web/ir_module.py @@ -1,7 +1,7 @@ from openerp.osv import osv import openerp.service.wsgi_server as oewsgi -from common.http import Root +from .http import Root class ir_module(osv.Model): _inherit = 'ir.module.module' From 3adab7ba8c71cd222e9f9b56cb50b8d7fdfe3ff8 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 15 Oct 2012 18:23:46 +0200 Subject: [PATCH 08/16] [IMP]: once bound, a session cannot be bound to another server bzr revid: chs@openerp.com-20121015162346-jwhctk988fftjsa4 --- addons/web/static/src/js/chrome.js | 24 ++++++++++++++++++------ addons/web/static/src/js/coresetup.js | 6 ++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 2b37ea9999a..5aa8be480d3 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1153,17 +1153,14 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ _template: 'EmbedClient', init: function(parent, origin, dbname, login, key, action_id, options) { this._super(parent, origin); - - this.dbname = dbname; - this.login = login; - this.key = key; + this.bind(dbname, login, key); this.action_id = action_id; this.options = options || {}; }, start: function() { var self = this; return $.when(this._super()).pipe(function() { - return instance.session.session_authenticate(self.dbname, self.login, self.key, true).pipe(function() { + return self.authenticate().pipe(function() { if (!self.action_id) { return; } @@ -1185,7 +1182,22 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ do_action: function(action) { return this.action_manager.do_action(action); - } + }, + + authenticate: function() { + var s = instance.session; + if (s.session_is_valid() && s.db === this.dbname && s.login === this.login) { + return $.when(); + } + return instance.session.session_authenticate(this.dbname, this.login, this.key, true); + }, + + bind: function(dbname, login, key) { + this.dbname = dbname; + this.login = login; + this.key = key; + }, + }); instance.web.embed = function (origin, dbname, login, key, action, options) { diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 1f1112df2f2..cf533ed0b59 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -27,6 +27,12 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess * Setup a sessionm */ session_bind: function(origin) { + if (!_.isUndefined(this.origin)) { + if (this.origin === origin) { + return $.when(); + } + throw new Error('Session already bound to ' + this.origin); + } var self = this; this.setup(origin); instance.web.qweb.default_dict['_s'] = this.origin; From f986227f8f0b354dd2ea4aabdcdec02b3628fdfd Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 30 Oct 2012 12:37:50 +0100 Subject: [PATCH 09/16] [IMP] reload: can wait server is available bzr revid: chs@openerp.com-20121030113750-4y039gx7cunwz859 --- addons/web/static/src/js/chrome.js | 51 ++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index d5f72ee8bb9..26f82665a03 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -615,22 +615,47 @@ instance.web.client_actions.add("login", "instance.web.Login"); /** * Client action to reload the whole interface. * If params has an entry 'menu_id', it opens the given menu entry. + * If params has an entry 'wait', reload will wait the openerp server to be reachable before reloading */ instance.web.Reload = function(parent, params) { - var menu_id = (params && params.menu_id) || false; - var l = window.location; - - var sobj = $.deparam(l.search.substr(1)); - sobj.ts = new Date().getTime(); - var search = '?' + $.param(sobj); - - var hash = l.hash; - if (menu_id) { - hash = "#menu_id=" + menu_id; + // hide errors + if (instance.client && instance.client.crashmanager) { + instance.client.crashmanager.destroy(); } - var url = l.protocol + "//" + l.host + l.pathname + search + hash; - window.onerror = function() {}; - window.location = url; + + var reload = function() { + console.log('relocate'); + var menu_id = (params && params.menu_id) || false; + var l = window.location; + + var sobj = $.deparam(l.search.substr(1)); + sobj.ts = new Date().getTime(); + var search = '?' + $.param(sobj); + + var hash = l.hash; + if (menu_id) { + hash = "#menu_id=" + menu_id; + } + var url = l.protocol + "//" + l.host + l.pathname + search + hash; + window.location = url; + }; + + var wait_server = function() { + parent.session.rpc("/web/webclient/version_info", {}) + .done(function() { + reload(); + }) + .fail(function() { + setTimeout(wait_server, 250); + }); + }; + + if (parent && params && params.wait) { + setTimeout(wait_server, 1000); + } else { + reload(); + } + }; instance.web.client_actions.add("reload", "instance.web.Reload"); From 1f91931fa3485046a8e471dfaa783197ef573855 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 31 Oct 2012 13:01:17 +0100 Subject: [PATCH 10/16] [FIX] "Home" client action can also wait server to be available bzr revid: chs@openerp.com-20121031120117-11n1alcu8jdv0je7 --- addons/web/static/src/js/chrome.js | 68 +++++++++++++++--------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 26f82665a03..5dd22a3212b 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -612,50 +612,51 @@ instance.web.Login = instance.web.Widget.extend({ }); instance.web.client_actions.add("login", "instance.web.Login"); -/** - * Client action to reload the whole interface. - * If params has an entry 'menu_id', it opens the given menu entry. - * If params has an entry 'wait', reload will wait the openerp server to be reachable before reloading - */ -instance.web.Reload = function(parent, params) { + +instance.web._relocate = function(url, wait) { // hide errors if (instance.client && instance.client.crashmanager) { instance.client.crashmanager.destroy(); } - var reload = function() { - console.log('relocate'); - var menu_id = (params && params.menu_id) || false; - var l = window.location; - - var sobj = $.deparam(l.search.substr(1)); - sobj.ts = new Date().getTime(); - var search = '?' + $.param(sobj); - - var hash = l.hash; - if (menu_id) { - hash = "#menu_id=" + menu_id; - } - var url = l.protocol + "//" + l.host + l.pathname + search + hash; - window.location = url; - }; - var wait_server = function() { - parent.session.rpc("/web/webclient/version_info", {}) + instance.session.rpc("/web/webclient/version_info", {}) .done(function() { - reload(); + window.location = url; }) .fail(function() { setTimeout(wait_server, 250); }); }; - if (parent && params && params.wait) { + if (wait) { setTimeout(wait_server, 1000); } else { - reload(); + window.location = url; } - +} + +/** + * Client action to reload the whole interface. + * If params has an entry 'menu_id', it opens the given menu entry. + * If params has an entry 'wait', reload will wait the openerp server to be reachable before reloading + */ +instance.web.Reload = function(parent, params) { + + var menu_id = (params && params.menu_id) || false; + var l = window.location; + + var sobj = $.deparam(l.search.substr(1)); + sobj.ts = new Date().getTime(); + var search = '?' + $.param(sobj); + + var hash = l.hash; + if (menu_id) { + hash = "#menu_id=" + menu_id; + } + var url = l.protocol + "//" + l.host + l.pathname + search + hash; + + instance.web._relocate(url, params && params.wait); }; instance.web.client_actions.add("reload", "instance.web.Reload"); @@ -665,7 +666,7 @@ instance.web.client_actions.add("reload", "instance.web.Reload"); */ instance.web.HistoryBack = function(parent, params) { if (!parent.history_back()) { - window.location = '/' + (window.location.search || ''); + instance.web.Home(parent); } }; instance.web.client_actions.add("history_back", "instance.web.HistoryBack"); @@ -673,11 +674,10 @@ instance.web.client_actions.add("history_back", "instance.web.HistoryBack"); /** * Client action to go back home. */ -instance.web.Home = instance.web.Widget.extend({ - init: function(parent, params) { - window.location = '/' + (window.location.search || ''); - } -}); +instance.web.Home = function(parent, params) { + var url = '/' + (window.location.search || ''); + instance.web._relocate(url, params && params.wait); +}; instance.web.client_actions.add("home", "instance.web.Home"); instance.web.ChangePassword = instance.web.Widget.extend({ From 595a2b3bb160351bca19c40414ede990f45376ea Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 6 Nov 2012 17:36:58 +0100 Subject: [PATCH 11/16] [IMP] only "special=cancel" buttons close the form bzr revid: chs@openerp.com-20121106163658-fez0bvbddjbuw5wi --- addons/web/static/src/js/views.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index ebc7c326724..bf7166eb7cf 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1234,7 +1234,7 @@ instance.web.View = instance.web.Widget.extend({ } }; - if (action_data.special) { + if (action_data.special === 'cancel') { return handler({"type":"ir.actions.act_window_close"}); } else if (action_data.type=="object") { var args = [[record_id]], additional_args = []; From c8e1d477990430028f9ad68d295b8d3d4017fd46 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 7 Nov 2012 18:18:20 +0100 Subject: [PATCH 12/16] :%s/_relocate/redirect/g bzr revid: chs@openerp.com-20121107171820-v7hryce3opnzuf0i --- addons/web/static/src/js/chrome.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 1b90ff3ff44..7fe750d1b60 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -613,7 +613,7 @@ instance.web.Login = instance.web.Widget.extend({ instance.web.client_actions.add("login", "instance.web.Login"); -instance.web._relocate = function(url, wait) { +instance.web.redirect = function(url, wait) { // hide errors if (instance.client && instance.client.crashmanager) { instance.client.crashmanager.destroy(); @@ -656,7 +656,7 @@ instance.web.Reload = function(parent, action) { } var url = l.protocol + "//" + l.host + l.pathname + search + hash; - instance.web._relocate(url, params.wait); + instance.web.redirect(url, params.wait); }; instance.web.client_actions.add("reload", "instance.web.Reload"); @@ -676,7 +676,7 @@ instance.web.client_actions.add("history_back", "instance.web.HistoryBack"); */ instance.web.Home = function(parent, action) { var url = '/' + (window.location.search || ''); - instance.web._relocate(url, action.params && action.params.wait); + instance.web.redirect(url, action.params && action.params.wait); }; instance.web.client_actions.add("home", "instance.web.Home"); From eaa3da915b5c3b22ddaaa2f4e29b1854e748e2f1 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 8 Nov 2012 15:50:01 +0100 Subject: [PATCH 13/16] [FIX] improve warning dialog css bzr revid: chs@openerp.com-20121108145001-pswe7r5ss4nzgu00 --- addons/web/static/src/css/base.css | 10 ++++++++++ addons/web/static/src/css/base.sass | 9 +++++++++ addons/web/static/src/xml/base.xml | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 94d02758ad0..b34e699b541 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -802,6 +802,16 @@ .openerp .oe_notification { z-index: 1050; } +.openerp .oe_dialog_warning { + width: 100%; +} +.openerp .oe_dialog_warning p { + text-align: center; +} +.openerp .oe_dialog_icon { + padding: 5px; + width: 32px; +} .openerp .oe_login { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=); text-align: center; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index f911929e159..368df7f047c 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -680,6 +680,15 @@ $sheet-padding: 16px .oe_notification z-index: 1050 // }}} + // CrashManager {{{ + .oe_dialog_warning + width: 100% + p + text-align: center + .oe_dialog_icon + padding: 5px + width: 32px + // }}} // Login {{{ .oe_login background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=) diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 215374cb6fb..553543f9d0a 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -36,11 +36,11 @@ - +

- var message = d.message ? d.message : d.error.data.fault_code; + var message = d.error.message ? d.error.message : d.error.data.fault_code; d.html_error = context.engine.tools.html_escape(message) .replace(/\n/g, '
');
From abdbd41a90f1f921812b10bf24347473d2b2cb39 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 14 Nov 2012 23:44:26 +0100 Subject: [PATCH 14/16] [FIX] embed client: use done() bzr revid: chs@openerp.com-20121114224426-nbp1zb9c2r2tcnn4 --- addons/web/static/src/js/chrome.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index c48c231bb99..9a0de562b11 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1218,7 +1218,7 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ if (!self.action_id) { return; } - return self.rpc("/web/action/load", { action_id: self.action_id }, function(result) { + return self.rpc("/web/action/load", { action_id: self.action_id }).done(function(result) { var action = result; action.flags = _.extend({ //views_switcher : false, From 0ad1f098316f65130b3b3cb88480929f294797a1 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Sun, 16 Dec 2012 03:40:27 +0100 Subject: [PATCH 15/16] [REV] unneeded api change bzr revid: al@openerp.com-20121216024027-1wjhic1hhjeh6v8p --- addons/web/controllers/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index cce0e33d525..0e93103d84a 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -693,7 +693,9 @@ class WebClient(openerpweb.Controller): @openerpweb.jsonrequest def version_info(self, req): - return req.session.proxy('common').version()['openerp'] + return { + "version": openerp.release.version + } class Proxy(openerpweb.Controller): _cp_path = '/web/proxy' From 3e1bce4badab7a2c38d68d6ff409c6093a3aacd9 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Wed, 19 Dec 2012 03:49:46 +0100 Subject: [PATCH 16/16] minor fixes bzr revid: al@openerp.com-20121219024946-6ezbvcizf09w8lio --- addons/web/__init__.py | 1 - addons/web/http.py | 14 ++++++-------- addons/web/ir_module.py | 17 ----------------- addons/web/static/src/js/chrome.js | 4 ++-- 4 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 addons/web/ir_module.py diff --git a/addons/web/__init__.py b/addons/web/__init__.py index b94c28cda7a..e01969ddcca 100644 --- a/addons/web/__init__.py +++ b/addons/web/__init__.py @@ -1,6 +1,5 @@ import http import controllers import cli -from . import ir_module wsgi_postload = http.wsgi_postload diff --git a/addons/web/http.py b/addons/web/http.py index 70df7b48051..508cd0451c5 100644 --- a/addons/web/http.py +++ b/addons/web/http.py @@ -480,7 +480,7 @@ class Root(object): self.addons = {} self.statics = {} - self._load_addons() + self.load_addons() # Setup http sessions path = session_path() @@ -493,7 +493,7 @@ class Root(object): """ return self.dispatch(environ, start_response) - def _dispatch(self, environ, start_response): + def dispatch(self, environ, start_response): """ Performs the actual WSGI dispatching for the application, may be wrapped during the initialization of the object. @@ -529,11 +529,9 @@ class Root(object): return response(environ, start_response) - def _load_addons(self): - """ - Loads all addons at the specified addons path, returns a mapping of - static URLs to the corresponding directories - """ + def load_addons(self): + """ Load all addons from addons patch containg static files and + controllers and configure them. """ for addons_path in openerp.modules.module.ad_paths: for module in os.listdir(addons_path): @@ -559,7 +557,7 @@ class Root(object): if hasattr(o, '_cp_path'): controllers_path[o._cp_path] = o - app = werkzeug.wsgi.SharedDataMiddleware(self._dispatch, self.statics) + app = werkzeug.wsgi.SharedDataMiddleware(self.dispatch, self.statics) self.dispatch = DisableCacheMiddleware(app) def find_handler(self, *l): diff --git a/addons/web/ir_module.py b/addons/web/ir_module.py deleted file mode 100644 index c4588b19aa6..00000000000 --- a/addons/web/ir_module.py +++ /dev/null @@ -1,17 +0,0 @@ -from openerp.osv import osv -import openerp.service.wsgi_server as oewsgi - -from .http import Root - -class ir_module(osv.Model): - _inherit = 'ir.module.module' - - def update_list(self, cr, uid, context=None): - result = super(ir_module, self).update_list(cr, uid, context=context) - - if tuple(result) != (0, 0): - for handler in oewsgi.module_handlers: - if isinstance(handler, Root): - handler._load_addons() - - return result diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index b73fe577923..a2ff00c5f03 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1326,7 +1326,7 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ _template: 'EmbedClient', init: function(parent, origin, dbname, login, key, action_id, options) { this._super(parent, origin); - this.bind(dbname, login, key); + this.bind_credentials(dbname, login, key); this.action_id = action_id; this.options = options || {}; }, @@ -1365,7 +1365,7 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ return instance.session.session_authenticate(this.dbname, this.login, this.key, true); }, - bind: function(dbname, login, key) { + bind_credentials: function(dbname, login, key) { this.dbname = dbname; this.login = login; this.key = key;