[MERGE] forward port of branch saas-3 up to revid 3995 chs@openerp.com-20140407144625...
authorChristophe Simonis <chs@openerp.com>
Mon, 7 Apr 2014 16:17:28 +0000 (18:17 +0200)
committerChristophe Simonis <chs@openerp.com>
Mon, 7 Apr 2014 16:17:28 +0000 (18:17 +0200)
bzr revid: chs@openerp.com-20140407161728-ccudwnqo970ac8ay

1  2 
addons/web/controllers/main.py
addons/web/static/src/css/base.css
addons/web/static/src/css/base.sass
addons/web/static/src/js/chrome.js
addons/web/static/src/js/view_form.js
addons/web/static/src/js/views.js
addons/web/static/src/xml/base.xml

@@@ -151,8 -140,17 +151,15 @@@ def ensure_db(redirect='/web/database/s
          # may depend on data injected by the database route dispatcher.
          # Thus, we redirect the user to the same page but with the session cookie set.
          # This will force using the database route dispatcher...
+         r = request.httprequest
+         url_redirect = r.base_url
+         if r.query_string:
+             # Can't use werkzeug.wrappers.BaseRequest.url with encoded hashes:
+             # https://github.com/amigrave/werkzeug/commit/b4a62433f2f7678c234cdcac6247a869f90a7eb7
+             url_redirect += '?' + r.query_string
+         response = werkzeug.utils.redirect(url_redirect, 302)
          request.session.db = db
-         abort_and_redirect(request.httprequest.url)
 -        response = r.app.get_response(r, response, explicit_session=False)
 -        werkzeug.exceptions.abort(response)
 -        return
++        abort_and_redirect(url_redirect)
  
      # if db not provided, use the session one
      if not db:
@@@ -649,11 -654,11 +656,14 @@@ class Home(http.Controller)
          ensure_db()
  
          if request.session.uid:
+             if kw.get('redirect'):
+                 return werkzeug.utils.redirect(kw.get('redirect'), 303)
 -            html = render_bootstrap_template(request.session.db, "web.webclient_bootstrap")
 -            return request.make_response(html, {'Cache-Control': 'no-cache', 'Content-Type': 'text/html; charset=utf-8'})
 +            headers = {
 +                'Cache-Control': 'no-cache',
 +                'Content-Type': 'text/html; charset=utf-8',
 +            }
 +            return render_bootstrap_template("web.webclient_bootstrap", headers=headers)
          else:
              return login_redirect()
  
      def web_login(self, redirect=None, **kw):
          ensure_db()
  
+         if request.httprequest.method == 'GET' and redirect and request.session.uid:
+             return http.redirect_with_hash(redirect)
 +        if not request.uid:
 +            request.uid = openerp.SUPERUSER_ID
 +
          values = request.params.copy()
          if not redirect:
              redirect = '/web?' + request.httprequest.query_string
Simple merge
Simple merge
Simple merge
@@@ -1988,10 -1979,13 +1991,12 @@@ instance.web.form.WidgetButton = instan
          var self = this;
  
          var context = this.build_context();
 -
          return this.view.do_execute_action(
              _.extend({}, this.node.attrs, {context: context}),
-             this.view.dataset, this.view.datarecord.id, function () {
-                 self.view.recursive_reload();
+             this.view.dataset, this.view.datarecord.id, function (reason) {
+                 if (!_.isObject(reason)) {
+                     self.view.recursive_reload();
+                 }
              });
      },
      check_disable: function() {
Simple merge
Simple merge