[MERGE] Forward-port of saas-5 up to 9ce08b7
This commit is contained in:
commit
d32d120a0a
|
@ -97,7 +97,6 @@
|
|||
<th>Description</th>
|
||||
<th>Reference</th>
|
||||
<th>Partner</th>
|
||||
<th>Type</th>
|
||||
<th>Account</th>
|
||||
<th class="text-right">Amount</th>
|
||||
</tr>
|
||||
|
@ -108,7 +107,6 @@
|
|||
<td><span t-field="line.name"/></td>
|
||||
<td><span t-field="line.ref"/></td>
|
||||
<td><span t-field="line.partner_id"/></td>
|
||||
<td><span t-field="line.type"/></td>
|
||||
<td><span t-field="line.account_id"/></td>
|
||||
<td class="text-right">
|
||||
<span t-field="line.amount"
|
||||
|
|
|
@ -260,8 +260,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 '''
|
||||
|
|
|
@ -78,10 +78,14 @@ class ir_http(orm.AbstractModel):
|
|||
request.session['geoip'] = record
|
||||
|
||||
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, code=302: werkzeug.utils.redirect(url_for(url), code)
|
||||
request.website = request.registry['website'].get_current_website(request.cr, request.uid, context=request.context)
|
||||
langs = [lg[0] for lg in request.website.get_languages()]
|
||||
|
|
|
@ -63,12 +63,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.urls.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):
|
||||
|
@ -102,7 +96,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
|
||||
|
@ -115,11 +112,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:
|
||||
|
|
|
@ -590,6 +590,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
|
||||
|
||||
|
|
Loading…
Reference in New Issue