# 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:
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
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() {