From fc5c53ca47c6a5822978395e96f9e1978e7bc1b5 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 5 Sep 2014 15:59:07 +0200 Subject: [PATCH 1/3] [FIX] point_of_sale: field type on bank statement line no longer exists --- addons/point_of_sale/views/report_sessionsummary.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/addons/point_of_sale/views/report_sessionsummary.xml b/addons/point_of_sale/views/report_sessionsummary.xml index 5f0f2617654..2f44afaa61b 100644 --- a/addons/point_of_sale/views/report_sessionsummary.xml +++ b/addons/point_of_sale/views/report_sessionsummary.xml @@ -97,7 +97,6 @@ Description Reference Partner - Type Account Amount @@ -108,7 +107,6 @@ - Date: Thu, 4 Sep 2014 16:31:30 +0200 Subject: [PATCH 2/3] [FIX] Restore /login redirection on SessionExpired The feature was broken due to an incompatibility when forward porting 624f256 and a78e27f --- addons/website/models/ir_http.py | 12 ++++++++---- openerp/addons/base/ir/ir_http.py | 18 ++++++------------ openerp/http.py | 6 ++++++ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index a145a30860e..9e30a07a64a 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -54,10 +54,14 @@ class ir_http(orm.AbstractModel): request.website_multilang = request.website_enabled and func and func.routing.get('multilang', True) if request.website_enabled: - if func: - self._authenticate(func.routing['auth']) - else: - self._auth_method_public() + try: + if func: + self._authenticate(func.routing['auth']) + else: + self._auth_method_public() + except Exception as e: + return self._handle_exception(e) + request.redirect = lambda url: werkzeug.utils.redirect(url_for(url)) request.website = request.registry['website'].get_current_website(request.cr, request.uid, context=request.context) if first_pass: diff --git a/openerp/addons/base/ir/ir_http.py b/openerp/addons/base/ir/ir_http.py index 21c8b7ef941..b3a2e785ca3 100644 --- a/openerp/addons/base/ir/ir_http.py +++ b/openerp/addons/base/ir/ir_http.py @@ -58,12 +58,6 @@ class ir_http(osv.AbstractModel): def _auth_method_user(self): request.uid = request.session.uid if not request.uid: - if not request.params.get('noredirect'): - query = werkzeug.url_encode({ - 'redirect': request.httprequest.url, - }) - response = werkzeug.utils.redirect('/web/login?%s' % query) - werkzeug.exceptions.abort(response) raise http.SessionExpiredException("Session expired") def _auth_method_none(self): @@ -97,7 +91,10 @@ class ir_http(osv.AbstractModel): def _handle_exception(self, exception): # If handle_exception returns something different than None, it will be used as a response - return request._handle_exception(exception) + try: + return request._handle_exception(exception) + except openerp.exceptions.AccessDenied: + return werkzeug.exceptions.Forbidden() def _dispatch(self): # locate the controller method @@ -110,11 +107,8 @@ class ir_http(osv.AbstractModel): # check authentication level try: auth_method = self._authenticate(func.routing["auth"]) - except Exception: - # force a Forbidden exception with the original traceback - return self._handle_exception( - convert_exception_to( - werkzeug.exceptions.Forbidden)) + except Exception as e: + return self._handle_exception(e) processing = self._postprocess_args(arguments, rule) if processing: diff --git a/openerp/http.py b/openerp/http.py index fe332c9ecb9..448a14e5958 100644 --- a/openerp/http.py +++ b/openerp/http.py @@ -542,6 +542,12 @@ class HttpRequest(WebRequest): be used as response.""" try: return super(HttpRequest, self)._handle_exception(exception) + except SessionExpiredException: + if not request.params.get('noredirect'): + query = werkzeug.urls.url_encode({ + 'redirect': request.httprequest.url, + }) + return werkzeug.utils.redirect('/web/login?%s' % query) except werkzeug.exceptions.HTTPException, e: return e From 9ce08b78ceeacb17024380ce5747338b247a9773 Mon Sep 17 00:00:00 2001 From: Niels Huylebroeck Date: Fri, 5 Sep 2014 13:59:48 +0200 Subject: [PATCH 3/3] [FIX] stock_account: Preserve action_done return value stock_account module override the action_done method of stock.move but does not return the same value This causes problems when calling this function from xmlrpc because the resulting value is now None and that is not allowed to be marshaled by default. --- addons/stock_account/stock_account.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index 545bdc05fec..6edc241aed4 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -256,8 +256,9 @@ class stock_move(osv.osv): def action_done(self, cr, uid, ids, context=None): self.product_price_update_before_done(cr, uid, ids, context=context) - super(stock_move, self).action_done(cr, uid, ids, context=context) + res = super(stock_move, self).action_done(cr, uid, ids, context=context) self.product_price_update_after_done(cr, uid, ids, context=context) + return res def _store_average_cost_price(self, cr, uid, move, context=None): ''' move is a browe record '''