From b4918347cc69165ff9cc15c2eb32207e2b5857fc Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 18 Dec 2013 12:19:37 +0100 Subject: [PATCH 01/38] [IMP] webclient entry point controller bzr revid: fme@openerp.com-20131218111937-hp5vfutci5x7k2p5 --- addons/web/controllers/main.py | 37 ++++++++++++++++------------------ 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 8f7c5d4f70d..750c581b90c 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -550,36 +550,33 @@ class Home(http.Controller): @http.route('/web', type='http', auth="none") def web_client(self, s_action=None, db=None, debug=False, **kw): - debug = debug != False + debug = bool(debug) - lst = http.db_list(True) - if db not in lst: - db = None - guessed_db = http.db_monodb(request.httprequest) - if guessed_db is None and len(lst) > 0: - guessed_db = lst[0] + # if db not provided, use the session one + if db is None: + db = request.session.db - def redirect(db): - query = dict(urlparse.parse_qsl(request.httprequest.query_string, keep_blank_values=True)) - query['db'] = db - redirect = request.httprequest.path + '?' + urllib.urlencode(query) - return redirect_with_hash(redirect) + # if no database provided and no database in session, use monodb + if db is None: + db = http.db_monodb(request.httprequest) - if db is None and guessed_db is not None: - return redirect(guessed_db) + # if no db can be found til here, send to the database selector + # the database selector will redirect to database manager if needed + if db is None: + return request.redirect('/database/selector', 303) # TODO: check status code semantic and forward debug - if db is not None and db != request.session.db: + # always switch the session to the computed db + if db != request.session.db: request.session.logout() - request.session.db = db - guessed_db = db + request.session.db = db - js = "\n ".join('' % i for i in manifest_list('js', db=guessed_db, debug=debug)) - css = "\n ".join('' % i for i in manifest_list('css', db=guessed_db, debug=debug)) + js = "\n ".join('' % i for i in manifest_list('js', db=db, debug=debug)) + css = "\n ".join('' % i for i in manifest_list('css', db=db, debug=debug)) r = html_template % { 'js': js, 'css': css, - 'modules': simplejson.dumps(module_boot(db=guessed_db)), + 'modules': simplejson.dumps(module_boot(db=db)), 'init': 'var wc = new s.web.WebClient();wc.appendTo($(document.body));' } return request.make_response(r, {'Cache-Control': 'no-cache', 'Content-Type': 'text/html; charset=utf-8'}) From 5d3891835b87bbc34283e6ea8112c57e1aaa6f0b Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 19 Dec 2013 14:04:45 +0100 Subject: [PATCH 02/38] [ADD] Client.client_options bzr revid: fme@openerp.com-20131219130445-tvola5kfm86b3blf --- addons/web/static/src/js/chrome.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index abbd4767361..f87e662dd90 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -659,7 +659,7 @@ instance.web.Login = instance.web.Widget.extend({ this._super(parent); this.has_local_storage = typeof(localStorage) != 'undefined'; this.db_list = null; - this.selected_db = null; + this.selected_db = this.client_options.dbname || null; this.selected_login = null; this.params = action.params || {}; if (_.isEmpty(this.params)) { @@ -1246,6 +1246,7 @@ instance.web.FullscreenWidget = instance.web.Widget.extend({ instance.web.Client = instance.web.Widget.extend({ init: function(parent, origin) { instance.client = instance.webclient = this; + this.client_options = {}; this._super(parent); this.origin = origin; }, @@ -1316,8 +1317,11 @@ instance.web.WebClient = instance.web.Client.extend({ events: { 'click .oe_logo_edit_admin': 'logo_edit' }, - init: function(parent) { + init: function(parent, client_options) { this._super(parent); + if (client_options) { + _.extend(this.client_options, client_options); + } this._current_state = null; this.menu_dm = new instance.web.DropMisordered(); this.action_mutex = new $.Mutex(); From 6754d72a93bed5607a7afd56fcc60fc99fce71cc Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 19 Dec 2013 14:46:01 +0100 Subject: [PATCH 03/38] [FIX] webclient reference bzr revid: fme@openerp.com-20131219134601-9lgi8d3x7e02umoq --- 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 f87e662dd90..90d13f0a67e 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -659,7 +659,7 @@ instance.web.Login = instance.web.Widget.extend({ this._super(parent); this.has_local_storage = typeof(localStorage) != 'undefined'; this.db_list = null; - this.selected_db = this.client_options.dbname || null; + this.selected_db = instance.webclient.client_options.dbname || null; this.selected_login = null; this.params = action.params || {}; if (_.isEmpty(this.params)) { From da780aa4784a09b3b4951152698cdbd63ca49a14 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 19 Dec 2013 15:36:48 +0100 Subject: [PATCH 04/38] [IMP] Database selector and manager bzr revid: fme@openerp.com-20131219143648-5jvlcet3yjsw6vq6 --- addons/web/controllers/main.py | 55 ++++++++++++++++++++--- addons/web/views/database_selector.html | 49 ++++++++++++++++++++ addons/web/views/webclient_bootstrap.html | 33 ++++++++++++++ 3 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 addons/web/views/database_selector.html create mode 100644 addons/web/views/webclient_bootstrap.html diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 750c581b90c..e00e3af689b 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -6,6 +6,7 @@ import csv import functools import glob import itertools +import jinja2 import logging import operator import datetime @@ -40,6 +41,12 @@ from openerp.http import request, serialize_exception as _serialize_exception _logger = logging.getLogger(__name__) +env = jinja2.Environment( + loader=jinja2.PackageLoader('openerp.addons.web', "views"), + autoescape=True +) +env.filters["json"] = simplejson.dumps + #---------------------------------------------------------- # OpenERP Web helpers #---------------------------------------------------------- @@ -108,8 +115,19 @@ def serialize_exception(f): return werkzeug.exceptions.InternalServerError(simplejson.dumps(error)) return wrap -def redirect_with_hash(url, code=303): - if request.httprequest.user_agent.browser in ('msie', 'safari'): +def redirect_with_hash(path, keep_query=None, exclude_query=[], code=303): + url = path + if keep_query: + query = dict(urlparse.parse_qsl(request.httprequest.query_string, keep_blank_values=True)) + for key in exclude_query: + query.pop(key, None) + if hasattr(keep_query, '__iter__'): + for key in query.keys(): + if key not in keep_query: + query.pop(key) + url = path + '?' + urllib.urlencode(query) + + if request.httprequest.user_agent.browser in ('msie', 'safari'): # Most IE and Safari versions decided not to preserve location.hash upon # redirect. And even if IE10 pretends to support it, it still fails # inexplicably in case of multiple redirects (and we do have some). @@ -514,6 +532,7 @@ def content_disposition(filename): # OpenERP Web web Controllers #---------------------------------------------------------- +# TODO: obsoleted by webclient_bootstrap() but need to change edi and pos addons html_template = """ @@ -540,13 +559,21 @@ html_template = """ """ +def webclient_bootstrap(**options): + for res in ['js', 'css']: + if res not in options: + options[res] = manifest_list(res, db=options.get('db'), debug=options.get('debug', request.debug)) + + if 'modules' not in options: + options['modules'] = module_boot(db=options.get('db')) + + return env.get_template("webclient_bootstrap.html").render(options) + class Home(http.Controller): @http.route('/', type='http', auth="none") def index(self, s_action=None, db=None, debug=False, **kw): - query = dict(urlparse.parse_qsl(request.httprequest.query_string, keep_blank_values=True)) - redirect = '/web' + '?' + urllib.urlencode(query) - return redirect_with_hash(redirect) + return redirect_with_hash('web', keep_query=True) @http.route('/web', type='http', auth="none") def web_client(self, s_action=None, db=None, debug=False, **kw): @@ -563,7 +590,7 @@ class Home(http.Controller): # if no db can be found til here, send to the database selector # the database selector will redirect to database manager if needed if db is None: - return request.redirect('/database/selector', 303) # TODO: check status code semantic and forward debug + return redirect_with_hash('/web/database/selector', keep_query=['debug']) # always switch the session to the computed db if db != request.session.db: @@ -753,6 +780,22 @@ class Proxy(http.Controller): class Database(http.Controller): + @http.route('/web/database/selector', type='http', auth="none") + def selector(self, debug=False): + dbs = http.db_list(True) + if not dbs: + return redirect_with_hash('/web/database/manager', keep_query=['debug']) + return env.get_template("database_selector.html").render({ + 'databases': dbs + }) + + @http.route('/web/database/manager', type='http', auth="none") + def manager(self, debug=False): + options = { + 'action': 'database_manager' + } + return webclient_bootstrap(client_options=options) + @http.route('/web/database/get_list', type='json', auth="none") def get_list(self): # TODO change js to avoid calling this method if in monodb mode diff --git a/addons/web/views/database_selector.html b/addons/web/views/database_selector.html new file mode 100644 index 00000000000..66315aedd42 --- /dev/null +++ b/addons/web/views/database_selector.html @@ -0,0 +1,49 @@ + + + + + OpenERP + + + + + + + +
+ + + + +
+ +
+
+ + + diff --git a/addons/web/views/webclient_bootstrap.html b/addons/web/views/webclient_bootstrap.html new file mode 100644 index 00000000000..12efa3c98b7 --- /dev/null +++ b/addons/web/views/webclient_bootstrap.html @@ -0,0 +1,33 @@ + + + + + + OpenERP + + + {% for css_file in css %} + + {% endfor %} + {% for js_file in js %} + + {% endfor %} + + + + + + From a47693ae73b12c00c0c63800cb0a46ee68888c73 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 19 Dec 2013 18:03:58 +0100 Subject: [PATCH 05/38] [FIX] database manager link bzr revid: fme@openerp.com-20131219170358-nujn0762d2j0qe2s --- addons/web/views/database_selector.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/views/database_selector.html b/addons/web/views/database_selector.html index 66315aedd42..3b475c083f5 100644 --- a/addons/web/views/database_selector.html +++ b/addons/web/views/database_selector.html @@ -35,7 +35,7 @@ From 90b63ee28c398f526148801e79a6081d34a538c5 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 19 Dec 2013 19:06:28 +0100 Subject: [PATCH 06/38] [FIX] support client_options.action and client_options.post_login_action bzr revid: fme@openerp.com-20131219180628-s95y5ryomnbgvko2 --- addons/web/static/src/js/chrome.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 90d13f0a67e..7d54efdfe7d 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1340,6 +1340,10 @@ instance.web.WebClient = instance.web.Client.extend({ } else { self.show_application(); } + if (self.client_options.action) { + self.action_manager.do_action(self.client_options.action); + delete(self.client_options.action); + } }); }, to_kitten: function() { @@ -1422,6 +1426,10 @@ instance.web.WebClient = instance.web.Client.extend({ self.bind_hashchange(); self.set_title(); self.check_timezone(); + if (self.client_options.action_post_login) { + self.action_manager.do_action(self.client_options.action_post_login); + delete(self.client_options.action_post_login); + } }, update_logo: function() { var img = this.session.url('/web/binary/company_logo'); From adfd2631e4ad747c17e1f663fbd69ce4d5f68456 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 19 Dec 2013 19:07:17 +0100 Subject: [PATCH 07/38] [FIX] correctly manager login query param bzr revid: fme@openerp.com-20131219180717-s9ec0oi5a0jl21o0 --- addons/web/controllers/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index e00e3af689b..e97314701d1 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -560,6 +560,7 @@ html_template = """ """ def webclient_bootstrap(**options): + # `options` can contain `client_options` dict. See chrome.js for more information about client_options. for res in ['js', 'css']: if res not in options: options[res] = manifest_list(res, db=options.get('db'), debug=options.get('debug', request.debug)) @@ -577,7 +578,7 @@ class Home(http.Controller): @http.route('/web', type='http', auth="none") def web_client(self, s_action=None, db=None, debug=False, **kw): - debug = bool(debug) + debug = debug is not False # we just check presence of `debug` query param # if db not provided, use the session one if db is None: @@ -782,15 +783,18 @@ class Database(http.Controller): @http.route('/web/database/selector', type='http', auth="none") def selector(self, debug=False): + debug = debug is not False # we just check presence of `debug` query param dbs = http.db_list(True) if not dbs: return redirect_with_hash('/web/database/manager', keep_query=['debug']) return env.get_template("database_selector.html").render({ - 'databases': dbs + 'databases': dbs, + 'debug': debug, }) @http.route('/web/database/manager', type='http', auth="none") def manager(self, debug=False): + debug = debug is not False # we just check presence of `debug` query param options = { 'action': 'database_manager' } From 34c2def1daffa397d78cb8bdb89f911709f9d0c0 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 19 Dec 2013 19:07:52 +0100 Subject: [PATCH 08/38] [FIX] webclient bootstrap constructor first parameter bzr revid: fme@openerp.com-20131219180752-wmjaalqhjt8dzs0i --- addons/web/views/webclient_bootstrap.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/views/webclient_bootstrap.html b/addons/web/views/webclient_bootstrap.html index 12efa3c98b7..097631d09ba 100644 --- a/addons/web/views/webclient_bootstrap.html +++ b/addons/web/views/webclient_bootstrap.html @@ -18,7 +18,7 @@ {% if init %} {{ init }} {% else %} - var wc = new s.web.WebClient({% if client_options %}{{ client_options | json | safe }}{% endif %}); + var wc = new s.web.WebClient({% if client_options %}null, {{ client_options | json | safe }}{% endif %}); wc.appendTo($(document.body)); {% endif %} }); From 4f952e73b4548a0ef3b8ea84ec6240ce2881d4db Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 19 Dec 2013 19:08:29 +0100 Subject: [PATCH 09/38] [IMP] forward debug query param in database manager link bzr revid: fme@openerp.com-20131219180829-4xqrcftp4gxs012y --- addons/web/views/database_selector.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/views/database_selector.html b/addons/web/views/database_selector.html index 3b475c083f5..6a47292efb4 100644 --- a/addons/web/views/database_selector.html +++ b/addons/web/views/database_selector.html @@ -35,7 +35,7 @@ From e8a00217414a442d5bba01591026ffc67847c76b Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 7 Jan 2014 12:45:35 +0100 Subject: [PATCH 10/38] [IMP] Replace html_template by webclient_bootstrap for /web/ route bzr revid: fme@openerp.com-20140107114535-u0kbdfeu3x9m01mv --- addons/web/controllers/main.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index e97314701d1..4e23a176d7e 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -598,16 +598,8 @@ class Home(http.Controller): request.session.logout() request.session.db = db - js = "\n ".join('' % i for i in manifest_list('js', db=db, debug=debug)) - css = "\n ".join('' % i for i in manifest_list('css', db=db, debug=debug)) - - r = html_template % { - 'js': js, - 'css': css, - 'modules': simplejson.dumps(module_boot(db=db)), - 'init': 'var wc = new s.web.WebClient();wc.appendTo($(document.body));' - } - return request.make_response(r, {'Cache-Control': 'no-cache', 'Content-Type': 'text/html; charset=utf-8'}) + html = webclient_bootstrap(db=db, debug=debug) + return request.make_response(html, {'Cache-Control': 'no-cache', 'Content-Type': 'text/html; charset=utf-8'}) @http.route('/login', type='http', auth="none") def login(self, db, login, key): From 16be0fa33af8fff40bae6692e65f2961bcac3685 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 7 Jan 2014 12:48:01 +0100 Subject: [PATCH 11/38] [IMP] update TODO bzr revid: fme@openerp.com-20140107114801-nlsi6zh1uhga805k --- 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 4e23a176d7e..2ddf8e559ba 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -532,7 +532,7 @@ def content_disposition(filename): # OpenERP Web web Controllers #---------------------------------------------------------- -# TODO: obsoleted by webclient_bootstrap() but need to change edi and pos addons +# TODO: obsoleted by webclient_bootstrap() but need to change edi and pos addons before removing this html_template = """ From b42fc403cbabdaedb1fd5e4c87d6ce5ecfe97550 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 9 Jan 2014 09:40:10 +0100 Subject: [PATCH 12/38] [IMP] Do not send button's name in form. Will require some styling tough bzr revid: fme@openerp.com-20140109084010-8ih86shohufur3mu --- addons/web/views/database_selector.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/views/database_selector.html b/addons/web/views/database_selector.html index 6a47292efb4..967b5fad082 100644 --- a/addons/web/views/database_selector.html +++ b/addons/web/views/database_selector.html @@ -30,7 +30,7 @@
  • - +
  • From 00582919791900f5cf83fb3d11a93aa53e2cc774 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 9 Jan 2014 16:11:40 +0100 Subject: [PATCH 13/38] [IMP] Use qweb template for login and webclient bootstrap The database manager should be rewritten server side bzr revid: fme@openerp.com-20140109151140-8x3ia8zpdpw1lics --- addons/web/__openerp__.py | 5 +- addons/web/controllers/main.py | 65 +++++++++++++++----- addons/web/views/webclient_bootstrap.html | 33 ---------- addons/web/views/webclient_templates.xml | 75 +++++++++++++++++++++++ 4 files changed, 127 insertions(+), 51 deletions(-) delete mode 100644 addons/web/views/webclient_bootstrap.html create mode 100644 addons/web/views/webclient_templates.xml diff --git a/addons/web/__openerp__.py b/addons/web/__openerp__.py index 09347eea24c..212a8a57cc6 100644 --- a/addons/web/__openerp__.py +++ b/addons/web/__openerp__.py @@ -12,7 +12,10 @@ This module provides the core of the OpenERP Web Client. 'depends': ['base'], 'auto_install': True, 'post_load': 'wsgi_postload', - 'js' : [ + 'data': [ + 'views/webclient_templates.xml', + ], + 'js': [ "static/lib/es5-shim/es5-shim.min.js", "static/lib/datejs/globalization/en-US.js", "static/lib/datejs/core.js", diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 2ddf8e559ba..5a5f9c6ae35 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -532,7 +532,8 @@ def content_disposition(filename): # OpenERP Web web Controllers #---------------------------------------------------------- -# TODO: obsoleted by webclient_bootstrap() but need to change edi and pos addons before removing this +# TODO: to remove once the database manager has been migrated server side +# and `edi` + `pos` addons has been adapted to use render_bootstrap_template() html_template = """ @@ -559,38 +560,45 @@ html_template = """ """ -def webclient_bootstrap(**options): - # `options` can contain `client_options` dict. See chrome.js for more information about client_options. +def render_bootstrap_template(db, template, values=None, **kw): + if values is None: + values = {} + values.update(kw) + for res in ['js', 'css']: - if res not in options: - options[res] = manifest_list(res, db=options.get('db'), debug=options.get('debug', request.debug)) + if res not in values: + values[res] = manifest_list(res, db=db, debug=values.get('debug', request.debug)) - if 'modules' not in options: - options['modules'] = module_boot(db=options.get('db')) + if 'modules' not in values: + values['modules'] = module_boot(db=db) + values['modules'] = simplejson.dumps(values['modules']) - return env.get_template("webclient_bootstrap.html").render(options) + registry = openerp.modules.registry.RegistryManager.get(db) + with registry.cursor() as cr: + view_obj = registry["ir.ui.view"] + return view_obj.render(cr, openerp.SUPERUSER_ID, template, values) class Home(http.Controller): @http.route('/', type='http', auth="none") def index(self, s_action=None, db=None, debug=False, **kw): - return redirect_with_hash('web', keep_query=True) + return redirect_with_hash('/web', keep_query=True) @http.route('/web', type='http', auth="none") def web_client(self, s_action=None, db=None, debug=False, **kw): debug = debug is not False # we just check presence of `debug` query param # if db not provided, use the session one - if db is None: + if not db: db = request.session.db # if no database provided and no database in session, use monodb - if db is None: + if not db: db = http.db_monodb(request.httprequest) # if no db can be found til here, send to the database selector # the database selector will redirect to database manager if needed - if db is None: + if not db: return redirect_with_hash('/web/database/selector', keep_query=['debug']) # always switch the session to the computed db @@ -598,8 +606,22 @@ class Home(http.Controller): request.session.logout() request.session.db = db - html = webclient_bootstrap(db=db, debug=debug) - return request.make_response(html, {'Cache-Control': 'no-cache', 'Content-Type': 'text/html; charset=utf-8'}) + if request.session.uid: + html = render_bootstrap_template(db, "web.webclient_bootstrap") + return request.make_response(html, {'Cache-Control': 'no-cache', 'Content-Type': 'text/html; charset=utf-8'}) + else: + return redirect_with_hash('/web/login', keep_query=True) + + @http.route('/web/login', type='http', auth="none") + def web_login(self, **kw): + assert request.session.db is not None + values = request.params.copy() + if request.httprequest.method == 'POST': + uid = request.session.authenticate(request.session.db, request.params['login'], request.params['password']) + if uid is not False: + return set_cookie_and_redirect('/web') + values['authentication_failed'] = True + return render_bootstrap_template(request.session.db, 'web.login', values) @http.route('/login', type='http', auth="none") def login(self, db, login, key): @@ -787,10 +809,19 @@ class Database(http.Controller): @http.route('/web/database/manager', type='http', auth="none") def manager(self, debug=False): debug = debug is not False # we just check presence of `debug` query param - options = { - 'action': 'database_manager' + js = "\n ".join('' % i for i in manifest_list('js', debug=debug)) + css = "\n ".join('' % i for i in manifest_list('css', debug=debug)) + + r = html_template % { + 'js': js, + 'css': css, + 'modules': simplejson.dumps(module_boot()), + 'init': """ + var wc = new s.web.WebClient(null, { action: 'database_manager' }); + wc.appendTo($(document.body)); + """ } - return webclient_bootstrap(client_options=options) + return r @http.route('/web/database/get_list', type='json', auth="none") def get_list(self): diff --git a/addons/web/views/webclient_bootstrap.html b/addons/web/views/webclient_bootstrap.html deleted file mode 100644 index 097631d09ba..00000000000 --- a/addons/web/views/webclient_bootstrap.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - OpenERP - - - {% for css_file in css %} - - {% endfor %} - {% for js_file in js %} - - {% endfor %} - - - - - - diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml new file mode 100644 index 00000000000..05c7b358915 --- /dev/null +++ b/addons/web/views/webclient_templates.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + From bf26965d9f0a4f0fa07c911a103c35337e1ae848 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 13 Jan 2014 11:28:38 +0100 Subject: [PATCH 14/38] [ADD] login container bzr revid: fme@openerp.com-20140113102838-7q3tegun1p51u6s4 --- addons/web/views/webclient_templates.xml | 40 +++++++++++++----------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index 05c7b358915..df0b1835ab8 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -47,26 +47,28 @@ From 4c4755ffae4af943daf826888ff4a7426687c33e Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 13 Jan 2014 15:37:02 +0100 Subject: [PATCH 15/38] [ADD] redirect option to /web/login bzr revid: fme@openerp.com-20140113143702-20j30wc3wuglp3mn --- addons/web/controllers/main.py | 5 +++-- addons/web/views/webclient_templates.xml | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 5a5f9c6ae35..fea22d6692d 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -613,13 +613,14 @@ class Home(http.Controller): return redirect_with_hash('/web/login', keep_query=True) @http.route('/web/login', type='http', auth="none") - def web_login(self, **kw): + def web_login(self, redir='/web', **kw): assert request.session.db is not None values = request.params.copy() + values['redir'] = redir if request.httprequest.method == 'POST': uid = request.session.authenticate(request.session.db, request.params['login'], request.params['password']) if uid is not False: - return set_cookie_and_redirect('/web') + return set_cookie_and_redirect(redir) values['authentication_failed'] = True return render_bootstrap_template(request.session.db, 'web.login', values) diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index df0b1835ab8..d4f6decb403 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -61,6 +61,7 @@ +

    Wrong login/password From 90ee743755bdc013a0633ac066d34264c7bd3866 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 13 Jan 2014 16:23:30 +0100 Subject: [PATCH 16/38] [FIX] remove login overload from web_hello module bzr revid: fme@openerp.com-20140113152330-hcz8nndr3gfxkx2o --- addons/web_hello/static/openerp/base_hello.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/addons/web_hello/static/openerp/base_hello.js b/addons/web_hello/static/openerp/base_hello.js index d36a6da6c13..2043af6d4ea 100644 --- a/addons/web_hello/static/openerp/base_hello.js +++ b/addons/web_hello/static/openerp/base_hello.js @@ -11,15 +11,6 @@ instance.web.SearchView = instance.web.SearchView.extend({ } }); -// here you may tweak globals object, if any, and play with on_* or do_* callbacks on them - -instance.web.Login = instance.web.Login.extend({ - start: function() { - console.log('Hello there'); - return this._super.apply(this,arguments); - } -}); - }; // vim:et fdc=0 fdl=0: From b7450672c03b0f1f3e2ee857af6736558aa4470e Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 13 Jan 2014 18:13:12 +0100 Subject: [PATCH 17/38] [IMP] Always allow /web/session/logout even if not logged in bzr revid: fme@openerp.com-20140113171312-sf2erlwby1kpw3a6 --- 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 fea22d6692d..7fd9dcd89a2 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1012,7 +1012,7 @@ class Session(http.Controller): def destroy(self): request.session.logout() - @http.route('/web/session/logout', type='http', auth="user") + @http.route('/web/session/logout', type='http', auth="none") def logout(self, redirect='/web'): request.session.logout() return werkzeug.utils.redirect(redirect, 303) From 3f34405c7ca001cfba610ae15e9120c0edbebeb1 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 13 Jan 2014 18:36:43 +0100 Subject: [PATCH 18/38] [IMP] login user at db creation bzr revid: fme@openerp.com-20140113173643-ire4cnb2nbxhs8dh --- addons/web/controllers/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 7fd9dcd89a2..4393823314c 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -809,6 +809,7 @@ class Database(http.Controller): @http.route('/web/database/manager', type='http', auth="none") def manager(self, debug=False): + request.session.logout() debug = debug is not False # we just check presence of `debug` query param js = "\n ".join('' % i for i in manifest_list('js', debug=debug)) css = "\n ".join('' % i for i in manifest_list('css', debug=debug)) @@ -838,12 +839,15 @@ class Database(http.Controller): @http.route('/web/database/create', type='json', auth="none") def create(self, fields): params = dict(map(operator.itemgetter('name', 'value'), fields)) - return request.session.proxy("db").create_database( + db_created = request.session.proxy("db").create_database( params['super_admin_pwd'], params['db_name'], bool(params.get('demo_data')), params['db_lang'], params['create_admin_pwd']) + if db_created: + request.session.authenticate(params['db_name'], 'admin', params['create_admin_pwd']) + return db_created @http.route('/web/database/duplicate', type='json', auth="none") def duplicate(self, fields): From 75e02860c25efa49228df411c3656b6a0d3861f1 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 13 Jan 2014 18:38:08 +0100 Subject: [PATCH 19/38] [REM] Removed Login from webclient bzr revid: fme@openerp.com-20140113173808-1clqlztx6fs79h2k --- addons/web/static/src/css/base.css | 149 +------------------ addons/web/static/src/css/base.sass | 102 ------------- addons/web/static/src/js/chrome.js | 220 ++-------------------------- addons/web/static/src/js/core.js | 2 +- addons/web/static/src/xml/base.xml | 40 ----- 5 files changed, 18 insertions(+), 495 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 51ab81010f8..d467de2946b 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1,4 +1,4 @@ -@charset "utf-8"; +@charset "UTF-8"; @font-face { font-family: "mnmliconsRegular"; src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot"); @@ -870,153 +870,6 @@ padding: 5px; width: 32px; } -.openerp .oe_login { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=); - text-align: center; - font-size: 14px; - height: 100%; -} -.openerp .oe_login ul, .openerp .oe_login li { - margin: 0; - list-style-type: none; - padding: 0 0 4px 0; -} -.openerp .oe_login button { - cursor: pointer; - padding: 6px 16px; - border: 1px solid #222222; - color: white; - margin: 0; - background-color: #8c1313; - background-image: -webkit-gradient(linear, left top, left bottom, from(#b92020), to(#600606)); - background-image: -webkit-linear-gradient(top, #b92020, #600606); - background-image: -moz-linear-gradient(top, #b92020, #600606); - background-image: -ms-linear-gradient(top, #b92020, #600606); - background-image: -o-linear-gradient(top, #b92020, #600606); - background-image: linear-gradient(to bottom, #b92020, #600606); - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; - -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset; - -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset; - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset; -} -.openerp .oe_login input, .openerp .oe_login select { - width: 252px; - font-family: "Lucida Grande", Helvetica, Verdana, Arial; - border: 1px solid #999999; - background: whitesmoke; - -moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4); - -webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4); - box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4); - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; -} -.openerp .oe_login input { - margin-bottom: 9px; - padding: 5px 6px; -} -.openerp .oe_login select { - padding: 1px; -} -.openerp .oe_login .oe_login_dbpane { - position: fixed; - top: 0; - right: 8px; - padding: 5px 10px; - color: #eeeeee; - border: solid 1px #333333; - background: #1e1e1e; - background: rgba(30, 30, 30, 0.94); - -moz-border-radius: 0 0 8px 8px; - -webkit-border-radius: 0 0 8px 8px; - border-radius: 0 0 8px 8px; -} -.openerp .oe_login .oe_login_dbpane input { - padding: 2px 4px; - margin: 4px 0; -} -.openerp .oe_login .oe_login_bottom { - position: absolute; - top: 50%; - left: 0; - right: 0; - bottom: 0; - text-shadow: 0 1px 1px #999999; - background-color: #8a0e0e; - background-image: -webkit-gradient(linear, left top, left bottom, from(#b41616), to(#600606)); - background-image: -webkit-linear-gradient(top, #b41616, #600606); - background-image: -moz-linear-gradient(top, #b41616, #600606); - background-image: -ms-linear-gradient(top, #b41616, #600606); - background-image: -o-linear-gradient(top, #b41616, #600606); - background-image: linear-gradient(to bottom, #b41616, #600606); -} -.openerp .oe_login .oe_login_pane { - position: absolute; - top: 50%; - left: 50%; - margin: -160px -166px; - border: solid 1px #333333; - background: #1e1e1e; - background: rgba(30, 30, 30, 0.94); - padding: 22px 32px; - color: #eeeeee; - text-align: left; - -moz-border-radius: 8px; - -webkit-border-radius: 8px; - border-radius: 8px; - -moz-box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); - -webkit-box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); - box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); -} -.openerp .oe_login .oe_login_pane h2 { - margin-top: 0; - font-size: 18px; -} -.openerp .oe_login .oe_login_logo { - position: absolute; - top: -70px; - left: 0; - width: 100%; - margin: 0 auto; - text-align: center; -} -.openerp .oe_login .oe_login_footer { - position: absolute; - bottom: -40px; - left: 0; - width: 100%; - text-align: center; -} -.openerp .oe_login .oe_login_footer a { - color: #eeeeee; - margin: 0 6px; -} -.openerp .oe_login .oe_login_footer a:hover { - text-decoration: underline; -} -.openerp .oe_login .oe_login_footer span { - font-weight: bold; - font-size: 16px; -} -.openerp .oe_login .oe_login_error_message { - display: none; - background-color: #b41616; - color: #eeeeee; - padding: 14px 18px; - margin-top: 15px; - text-align: center; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; - -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); - -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); - box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); -} -.openerp .oe_login_invalid .oe_login_error_message { - display: inline-block; -} .openerp .oe_database_manager { background: white; color: black; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 27f99ccc9d9..ff40c3c67db 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -744,108 +744,6 @@ $sheet-padding: 16px padding: 5px width: 32px // }}} - // Login {{{ - .oe_login - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=) - text-align: center - font-size: 14px - height: 100% - ul, li - margin: 0 - list-style-type: none - padding: 0 0 4px 0 - button - cursor: pointer - padding: 6px 16px - border: 1px solid #222 - color: white - margin: 0 - @include vertical-gradient(#b92020, #600606) - @include radius(4px) - @include box-shadow((0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset)) - input, select - width: 252px - font-family: "Lucida Grande", Helvetica, Verdana, Arial - border: 1px solid #999999 - background: whitesmoke - @include box-shadow(inset 0 1px 4px rgba(0, 0, 0, 0.4)) - @include radius(3px) - input - margin-bottom: 9px - padding: 5px 6px - select - padding: 1px - .oe_login_dbpane - position: fixed - top: 0 - right: 8px - padding: 5px 10px - color: #eee - border: solid 1px #333 - background: #1e1e1e - background: rgba(30,30,30,0.94) - @include radius(0 0 8px 8px) - input - padding: 2px 4px - margin: 4px 0 - .oe_login_bottom - position: absolute - top: 50% - left: 0 - right: 0 - bottom: 0 - text-shadow: 0 1px 1px #999999 - @include vertical-gradient(#b41616, #600606) - .oe_login_pane - position: absolute - top: 50% - left: 50% - margin: -160px -166px - border: solid 1px #333333 - background: #1e1e1e - background: rgba(30,30,30,0.94) - padding: 22px 32px - color: #eee - text-align: left - @include radius(8px) - @include box-shadow(0 0 18px rgba(0, 0, 0, 0.9)) - h2 - margin-top: 0 - font-size: 18px - .oe_login_logo - position: absolute - top: -70px - left: 0 - width: 100% - margin: 0 auto - text-align: center - .oe_login_footer - position: absolute - bottom: -40px - left: 0 - width: 100% - text-align: center - a - color: #eee - margin: 0 6px - &:hover - text-decoration: underline - span - font-weight: bold - font-size: 16px - .oe_login_error_message - display: none - background-color: #b41616 - color: #eee - padding: 14px 18px - margin-top: 15px - text-align: center - @include radius(4px) - @include box-shadow(0 1px 4px rgba(0, 0, 0, 0.8)) - .oe_login_invalid - .oe_login_error_message - display: inline-block - // }}} // DatabaseManager {{{ .oe_database_manager background: #fff diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 7d54efdfe7d..caac5c394ae 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -475,19 +475,6 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ this.$el.find('#db-create, #db-drop, #db-backup, #db-restore, #db-change-password, #back-to-login').unbind('click').end().empty(); this._super(); }, - /** - * Converts a .serializeArray() result into a dict. Does not bother folding - * multiple identical keys into an array, last key wins. - * - * @param {Array} array - */ - to_object: function (array) { - var result = {}; - _(array).each(function (record) { - result[record.name] = record.value; - }); - return result; - }, /** * Blocks UI and replaces $.unblockUI by a noop to prevent third parties * from unblocking the UI @@ -525,25 +512,11 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ var self = this; var fields = $(form).serializeArray(); self.rpc("/web/database/create", {'fields': fields}).done(function(result) { - var form_obj = self.to_object(fields); - var client_action = { - type: 'ir.actions.client', - tag: 'login', - params: { - 'db': form_obj['db_name'], - 'login': 'admin', - 'password': form_obj['create_admin_pwd'], - 'login_successful': function() { - var url = '/web?db=' + form_obj['db_name']; - if (self.session.debug) { - url += '&debug'; - } - instance.web.redirect(url); - }, - }, - _push_me: false, - }; - self.do_action(client_action); + if (result) { + instance.web.redirect('/web') + } else { + alert("Failed to create database"); + } }); }, do_duplicate: function(form) { @@ -641,156 +614,20 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ }, do_exit: function () { this.$el.remove(); - instance.webclient.show_login(); + instance.web.redirect('/web'); } }); instance.web.client_actions.add("database_manager", "instance.web.DatabaseManager"); -instance.web.Login = instance.web.Widget.extend({ - template: "Login", - remember_credentials: true, - events: { - 'change input[name=db],select[name=db]': function(ev) { - this.set('database_selector', $(ev.currentTarget).val()); - }, - }, +instance.web.login = function() { + instance.web.redirect('/web/login'); +}; +instance.web.client_actions.add("login", "instance.web.login"); - init: function(parent, action) { - this._super(parent); - this.has_local_storage = typeof(localStorage) != 'undefined'; - this.db_list = null; - this.selected_db = instance.webclient.client_options.dbname || null; - this.selected_login = null; - this.params = action.params || {}; - if (_.isEmpty(this.params)) { - this.params = $.bbq.getState(true); - } - if (action && action.params && action.params.db) { - this.params.db = action.params.db; - } else if ($.deparam.querystring().db) { - this.params.db = $.deparam.querystring().db; - } - if (this.params.db) { - this.selected_db = this.params.db; - } - - if (this.params.login_successful) { - this.on('login_successful', this, this.params.login_successful); - } - // some cleanup to remove any trace of that last login feature - if (typeof(localStorage) != 'undefined') { - var toRemove = []; - _.each(_.range(localStorage.length), function(i) { - var key = localStorage.key(i); - if (key.match(/^.*?\|last_password$/)) { - toRemove.push(key); - } - }); - _.each(toRemove, function(k) { - localStorage.removeItem(k); - }); - } - }, - start: function() { - var self = this; - self.$el.find("form").submit(self.on_submit); - self.$el.find('.oe_login_manage_db').click(function() { - self.do_action("database_manager"); - }); - self.on('change:database_selector', this, function() { - this.database_selected(this.get('database_selector')); - }); - var d = $.when(); - if ($.param.fragment().token) { - self.params.token = $.param.fragment().token; - } - // used by dbmanager.do_create via internal client action - if (self.params.db && self.params.login && self.params.password) { - d = self.do_login(self.params.db, self.params.login, self.params.password); - } else { - d = self.rpc("/web/database/get_list", {}) - .done(self.on_db_loaded) - .fail(self.on_db_failed) - .always(function() { - if (self.selected_db && self.has_local_storage && self.remember_credentials) { - self.$("[name=login]").val(localStorage.getItem(self.selected_db + '|last_login') || ''); - } - }); - } - return d; - }, - database_selected: function(db) { - var params = $.deparam.querystring(); - params.db = db; - this.$('.oe_login_dbpane').empty().text(_t('Loading...')); - this.$('[name=login], [name=password]').prop('readonly', true); - instance.web.redirect('/web?' + $.param(params)); - }, - on_db_loaded: function (result) { - var self = this; - this.db_list = result; - if (!this.selected_db) { - this.selected_db = result[0]; - } - this.$("[name=db]").replaceWith(QWeb.render('Login.dblist', { db_list: this.db_list, selected_db: this.selected_db})); - if(this.db_list.length === 0) { - this.do_action("database_manager"); - } else if(this.db_list.length === 1) { - this.$('div.oe_login_dbpane').hide(); - } else { - this.$('div.oe_login_dbpane').show(); - } - }, - on_db_failed: function (error, event) { - if (error.data.name === 'openerp.exceptions.AccessDenied') { - event.preventDefault(); - } - }, - on_submit: function(ev) { - if(ev) { - ev.preventDefault(); - } - var db = this.$("form [name=db]").val(); - if (!db) { - this.do_warn(_t("Login"), _t("No database selected !")); - return false; - } - var login = this.$("form input[name=login]").val(); - var password = this.$("form input[name=password]").val(); - - this.do_login(db, login, password); - }, - /** - * Performs actual login operation, and UI-related stuff - * - * @param {String} db database to log in - * @param {String} login user login - * @param {String} password user password - */ - do_login: function (db, login, password) { - var self = this; - self.hide_error(); - self.$(".oe_login_pane").fadeOut("slow"); - return this.session.session_authenticate(db, login, password).then(function() { - if (self.has_local_storage && self.remember_credentials) { - localStorage.setItem(db + '|last_login', login); - } - self.trigger('login_successful'); - }, function () { - self.$(".oe_login_pane").fadeIn("fast", function() { - self.show_error(_t("Invalid username or password")); - }); - }); - }, - show_error: function(message) { - this.$el.addClass("oe_login_invalid"); - this.$(".oe_login_error_message").text(message); - }, - hide_error: function() { - this.$el.removeClass('oe_login_invalid'); - }, -}); -instance.web.client_actions.add("login", "instance.web.Login"); +instance.web.logout = function() { + instance.web.redirect('/web/session/logout'); +}; +instance.web.client_actions.add("logout", "instance.web.logout"); /** @@ -1335,9 +1172,7 @@ instance.web.WebClient = instance.web.Client.extend({ if (jQuery.deparam !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined) { self.to_kitten(); } - if (!self.session.session_is_valid()) { - self.show_login(); - } else { + if (self.session.session_is_valid()) { self.show_application(); } if (self.client_options.action) { @@ -1393,25 +1228,6 @@ instance.web.WebClient = instance.web.Client.extend({ }); }; }, - show_login: function() { - this.toggle_bars(false); - - var state = $.bbq.getState(true); - var action = { - type: 'ir.actions.client', - tag: 'login', - _push_me: false, - }; - - this.action_manager.do_action(action); - this.action_manager.inner_widget.on('login_successful', this, function() { - if ('redirect' in state) { - openerp.web.redirect(state.redirect); - } else { - this.show_application(); // will load the state we just pushed - } - }); - }, show_application: function() { var self = this; self.toggle_bars(true); @@ -1510,11 +1326,7 @@ instance.web.WebClient = instance.web.Client.extend({ on_logout: function() { var self = this; if (!this.has_uncommitted_changes()) { - this.session.session_logout().done(function () { - $(window).unbind('hashchange', self.on_hashchange); - self.do_push_state({}); - window.location.reload(); - }); + self.action_manager.do_action('logout'); } }, bind_hashchange: function() { diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index 81e029f5f87..b92ca1d3ba5 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -252,7 +252,7 @@ instance.web.Session.include( /** @lends instance.web.Session# */{ return !!this.uid; }, /** - * The session is validated either by login or by restoration of a previous session + * The session is validated by restoration of a previous session */ session_authenticate: function() { var self = this; diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 8f562048682..9ad26784929 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -58,46 +58,6 @@ - -